24 lines
480 B
Plaintext
24 lines
480 B
Plaintext
---
|
|
export interface Props {
|
|
name: string,
|
|
};
|
|
|
|
const { name } = Astro.props;
|
|
|
|
const icons = import.meta.glob<{string: string}>('@components/icons/*.svg', { query: '?raw', import: 'default' });
|
|
const path = `/src/components/icons/${name}.svg`;
|
|
if (icons[path] === undefined) {
|
|
throw new Error(`Icon ${name} does not exist.`);
|
|
}
|
|
const icon = await icons[path]();
|
|
---
|
|
|
|
<Fragment set:html={icon} />
|
|
|
|
<style>
|
|
svg {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|