Feedback: Icon-Buttons — Haus/Wolke-Chips, Download-Pfeil auf laden, Papierkorb auf löschen, Play-Icon
This commit is contained in:
32
src/lib/Icon.svelte
Normal file
32
src/lib/Icon.svelte
Normal file
@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
// Minimal-Icon-Set (Stroke-Stil, currentColor)
|
||||
const icons: Record<string, string> = {
|
||||
home: '<path d="M3 10.5 12 3l9 7.5"/><path d="M5 9.5V21h5v-6h4v6h5V9.5"/>',
|
||||
cloud:
|
||||
'<path d="M6.5 19a4.5 4.5 0 1 1 .42-8.98 6 6 0 0 1 11.6 1.4A4 4 0 0 1 18 19H6.5z"/>',
|
||||
download: '<path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/>',
|
||||
trash:
|
||||
'<path d="M4 7h16"/><path d="M9 7V4h6v3"/><path d="M6.5 7l1 14h9l1-14"/>',
|
||||
play: '<path d="M8 5v14l11-7z" fill="currentColor" stroke="none"/>',
|
||||
x: '<path d="M5 5l14 14"/><path d="M19 5 5 19"/>',
|
||||
}
|
||||
|
||||
let { name, size = 15 }: { name: string; size?: number } = $props()
|
||||
|
||||
const markup = $derived(
|
||||
`<svg viewBox="0 0 24 24" width="${String(size)}" height="${String(size)}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icons[name] ?? ''}</svg>`
|
||||
)
|
||||
</script>
|
||||
|
||||
<span class="hw-icon" style={`width:${size}px;height:${size}px`}>{@html markup}</span>
|
||||
|
||||
<style>
|
||||
.hw-icon {
|
||||
display: inline-flex;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.hw-icon :global(svg) {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user