Comments (2)
Some interesting gotchas with using SVG with an <img>
tag, you can't style the interior contents of the SVG this way!
https://css-tricks.com/using-svg/
The problem with both img and background-image…
Is that you don’t get to control the innards of the SVG with CSS like you can with the following two ways. Read on!
I have no idea how I didn't already know this, probably one of those things I've learned but forgot. However, this means the idea of using that method kind of goes out the window.
from skeleton.
So I came up with a great solution for handling SVGs that I think bridges the best ideas from both Nik and myself.
The notable changes include:
- I've introduced a new standardized component called
SvgIcon
:
https://github.com/Brain-Bones/skeleton/blob/dev/src/lib/SvgIcon/SvgIcon.svelte - I've bundled all SVG path data into a single definition file called
icons.ts
:
https://github.com/Brain-Bones/skeleton/blob/dev/src/lib/SvgIcon/icons.ts - I've updated all instances of SVG icons throughout the project to utilize this new component.
The combines Nik's idea of leaning into a Svelte component, plus my idea of documenting in a single file, while creating a brand new component that follows the Skeleton conventions for props, including passthrough attributes, Tailwind styles, generic styles, and A11y support. Plus icon.ts
allows us to add the missing Font Awesome attribution.
Additionally, this can still be used with standard SVG child content - you just drop any any code that would normally live between the <svg>...</svg>
tags in as the default slot value.
I've documented the component here:
https://github.com/Brain-Bones/skeleton/blob/dev/src/routes/components/svg-icons/%2Bpage.svelte
Though please note this doc page is currently hidden from the nav bar. I would like to dogfood the component for a bit before we release it to the public. The biggest drawback is the canned set of icons are pretty limited (just what we use in components and docs). However, the ability to build your own is pretty nice. The fact the component comes with default sizes and styling is really nice. Plus there's a default icon shown if you don't provide a name or slot value.
This has been merged into dev
if you would like to test it yourselves.
from skeleton.
Related Issues (20)
- Add special comment to Tailwind config to enable HRM reloading on plugin changes
- Improve intermediate page navigation UI
- favicon.png HOT 2
- Modals prerequisites should also import Modal
- error in docs
- Progress Bars: discrepancy in usage code
- Codeblocks with shiki highlighter HOT 3
- Modal rendering inconsistent. Disappearing Modals. HOT 1
- NEXT Iconography Docs
- Feature request: Support popular routers like svelte-spa-router and routify HOT 6
- NEXT React Form Handling HOT 1
- NEXT Date Picker and Date Handling HOT 1
- Installing with bun hits exception HOT 2
- Add accessibility attributes to Autocomplete HOT 1
- [Skeleton v2] - Light scrollbar is displayed instead of dark one on Opera browser HOT 4
- Autocomplete page: Add blurb about importing popup in popup section
- AppRailTile and AppRailAnchor default styling
- progressbar.css in build HOT 1
- v3 dep bump
- Possibilty to disable focus of Ratings component inner buttons HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skeleton.