25 lines
613 B
Svelte
25 lines
613 B
Svelte
<script lang="ts">
|
|||
|
|
// Icône du sprite GONG. <Icon name="ka" /> → <use href="/icons.svg#ka">.
|
||
|
|
// Décoratif par défaut (aria-hidden) ; passer `label` pour une icône signifiante.
|
||
|
|
import { asset } from '$app/paths';
|
||
|
|
|
||
|
|
interface Props {
|
||
|
|
name: string;
|
||
|
|
label?: string;
|
||
|
|
size?: string;
|
||
|
|
class?: string;
|
||
|
|
}
|
||
|
|
let { name, label, size = '1.25em', class: cls = '' }: Props = $props();
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<svg
|
||
|
|
class="icon {cls}"
|
||
|
|
style:width={size}
|
||
|
|
style:height={size}
|
||
|
|
role={label ? 'img' : undefined}
|
||
|
|
aria-label={label}
|
||
|
|
aria-hidden={label ? undefined : 'true'}
|
||
|
|
>
|
||
|
|
<use href={asset(`/icons.svg#${name}`)} />
|
||
|
|
</svg>
|