A website inspired by Last.fm that will keep track of your listening statistics
lastfm
music
statistics
1<script lang="ts">
2 import Icon from "$lib/components/content/Icon.svelte";
3 import type { ButtonProps } from "$lib/types";
4
5 let {
6 children,
7 icon,
8 shape = "square",
9 scheme = "default",
10 variant = "default",
11 icon_position = "left",
12 class: class_,
13 ...rest
14 }: ButtonProps = $props();
15
16 let classes = $derived([
17 scheme === "default" && "scheme-default",
18 scheme === "primary" && "scheme-primary",
19 variant === "default" && "variant-default",
20 variant === "text" && "variant-text",
21 shape === "square" && "shape-square",
22 shape === "rounded" && "shape-rounded",
23 shape === "circle" && "shape-circle",
24 icon !== undefined && "with-icon",
25 "button",
26 class_,
27 ]);
28</script>
29
30<button class={classes} {...rest}>
31 {#if icon && icon_position === "left"}
32 <Icon name={icon} />
33 {/if}
34 {#if children}
35 {@render children()}
36 {/if}
37 {#if icon && icon_position === "right"}
38 <Icon name={icon} />
39 {/if}
40</button>