Files
gpx.studio/website/src/lib/components/ui/card/card.svelte

23 lines
811 B
Svelte
Raw Normal View History

2024-04-19 16:13:08 +02:00
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
2025-06-21 21:07:36 +02:00
import { cn, type WithElementRef } from "$lib/utils.js";
2024-04-19 16:13:08 +02:00
2025-06-08 16:32:41 +02:00
let {
ref = $bindable(null),
class: className,
children,
2026-04-06 18:22:01 +02:00
size = "default",
2025-06-08 16:32:41 +02:00
...restProps
2026-04-06 18:22:01 +02:00
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & { size?: "default" | "sm" } = $props();
2024-04-19 16:13:08 +02:00
</script>
<div
2025-06-08 16:32:41 +02:00
bind:this={ref}
2025-06-21 21:07:36 +02:00
data-slot="card"
2026-04-06 18:22:01 +02:00
data-size={size}
class={cn("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col", className)}
2025-06-08 16:32:41 +02:00
{...restProps}
2024-04-19 16:13:08 +02:00
>
2025-06-08 16:32:41 +02:00
{@render children?.()}
2024-04-19 16:13:08 +02:00
</div>