summaryrefslogtreecommitdiffstatshomepage
path: root/frontend/src/lib/components/Expander.svelte
blob: 8f23042dd2948b2c00c42e79324dcaabaced1598 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script lang="ts">
	interface Props {
		expanded: boolean;
		title: string;
	}

	let { expanded = $bindable(), title }: Props = $props();

	function onclick() {
		expanded = !expanded;
	}
</script>

<button class="flex items-center text-base hover:text-white" type="button" {onclick}>
	{#if expanded}
		<span class="icon-base icon-[material-symbols--expand-less]"></span>
	{:else}
		<span class="icon-base icon-[material-symbols--expand-more]"></span>
	{/if}
	{title}
</button>