Skip to content

Commit 284bc12

Browse files
authored
Merge pull request #301 from scroll-tech/sibebar-improvement
Sibebar improvement
2 parents e115453 + d89b925 commit 284bc12

File tree

4 files changed

+266
-38
lines changed

4 files changed

+266
-38
lines changed

src/components/Icons/Icons.astro

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
import { Icons } from "./Icons"
3+
interface Props {
4+
name: keyof typeof Icons
5+
label?: string
6+
color?: string
7+
size?: string
8+
class?: string
9+
}
10+
const { name, label, size = "1em", color } = Astro.props
11+
const a11yAttrs = label ? ({ "aria-label": label } as const) : ({ "aria-hidden": "true" } as const)
12+
---
13+
14+
<svg
15+
{...a11yAttrs}
16+
class={Astro.props.class}
17+
width="16"
18+
height="16"
19+
viewBox="0 0 24 24"
20+
fill="currentColor"
21+
set:html={Icons[name]}
22+
/>
23+
24+
<style define:vars={{ "sl-icon-color": color, "sl-icon-size": size }}>
25+
svg {
26+
color: var(--sl-icon-color);
27+
font-size: var(--sl-icon-size, 1em);
28+
width: 1em;
29+
height: 1em;
30+
}
31+
</style>

0 commit comments

Comments
 (0)