🧼 Cleans up setting card

This commit is contained in:
Rune Harlyk
2025-03-20 15:31:44 +01:00
committed by Rune Harlyk
parent 17e30ebfe9
commit 569c19ad1d
+22 -31
View File
@@ -1,31 +1,24 @@
<script lang="ts"> <script lang="ts">
import { slide } from 'svelte/transition'; import { slide } from 'svelte/transition'
import { cubicOut } from 'svelte/easing'; import { cubicOut } from 'svelte/easing'
import { Down } from './icons'; import { Down } from './icons'
interface Props { interface Props {
open?: boolean; open?: boolean
collapsible?: boolean; collapsible?: boolean
icon?: import('svelte').Snippet; icon?: import('svelte').Snippet
title?: import('svelte').Snippet; title?: import('svelte').Snippet
children?: import('svelte').Snippet; children?: import('svelte').Snippet
right?: import('svelte').Snippet
} }
let { let { open = $bindable(true), collapsible = true, icon, title, children, right }: Props = $props()
open = $bindable(true),
collapsible = true,
icon,
title,
children
}: Props = $props();
</script> </script>
{#if collapsible} {#if collapsible}
<div <div
class="bg-base-200 rounded-box relative grid w-full max-w-2xl self-center overflow-hidden shadow-lg" class="bg-base-200 rounded-box relative grid w-full max-w-2xl self-center overflow-hidden shadow-lg">
>
<div <div
class="min-h-16 flex w-full items-center justify-between space-x-3 p-4 text-xl font-medium" class="min-h-16 flex w-full items-center justify-between space-x-3 p-4 text-xl font-medium">
>
<span class="inline-flex items-baseline"> <span class="inline-flex items-baseline">
{@render icon?.()} {@render icon?.()}
{@render title?.()} {@render title?.()}
@@ -33,34 +26,32 @@
<button <button
class="btn btn-circle btn-ghost btn-sm" class="btn btn-circle btn-ghost btn-sm"
onclick={() => { onclick={() => {
open = !open; open = !open
}} }}>
>
<Down <Down
class="text-base-content h-auto w-6 transition-transform duration-300 ease-in-out {open class="text-base-content h-auto w-6 transition-transform duration-300 ease-in-out {open ?
? 'rotate-180' 'rotate-180'
: ''}" : ''}" />
/>
</button> </button>
</div> </div>
{#if open} {#if open}
<div <div
class="flex flex-col gap-2 p-4 pt-0" class="flex flex-col gap-2 p-4 pt-0"
transition:slide|local={{ duration: 300, easing: cubicOut }} transition:slide|local={{ duration: 300, easing: cubicOut }}>
>
{@render children?.()} {@render children?.()}
</div> </div>
{/if} {/if}
</div> </div>
{:else} {:else}
<div <div
class="bg-base-200 rounded-box relative grid w-full max-w-2xl self-center overflow-hidden shadow-lg" class="bg-base-200 rounded-box relative grid w-full max-w-2xl self-center overflow-hidden shadow-lg">
> <div
<div class="min-h-16 w-full p-4 text-xl font-medium"> class="min-h-16 flex w-full items-center justify-between space-x-3 p-4 text-xl font-medium">
<span class="inline-flex items-baseline"> <span class="inline-flex items-baseline">
{@render icon?.()} {@render icon?.()}
{@render title?.()} {@render title?.()}
</span> </span>
{@render right?.()}
</div> </div>
<div class="flex flex-col gap-2 p-4 pt-0"> <div class="flex flex-col gap-2 p-4 pt-0">
{@render children?.()} {@render children?.()}