mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-02 19:17:03 +00:00
32 lines
635 B
Plaintext
32 lines
635 B
Plaintext
---
|
|
const icons = import.meta.glob("../icons/*.svg", {
|
|
query: "?raw",
|
|
import: "default",
|
|
eager: true,
|
|
});
|
|
|
|
interface Props {
|
|
name: string;
|
|
label?: string;
|
|
class?: string;
|
|
}
|
|
const { name, label, class: cls } = Astro.props;
|
|
const svg = (icons[`../icons/${name}.svg`] as string | undefined) ?? "";
|
|
---
|
|
|
|
<span class:list={["brand-icon", cls]} role="img" aria-label={label} set:html={svg}></span>
|
|
|
|
<style is:global>
|
|
.brand-icon {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
line-height: 0;
|
|
}
|
|
.brand-icon svg {
|
|
width: 100%;
|
|
height: 100%;
|
|
fill: currentColor;
|
|
}
|
|
</style>
|