~james/core

core/web/src/lib/components/repo/RepoSection.svelte -rw-r--r-- 1.2 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 16 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<script lang="ts">
	import type { Component, Snippet } from "svelte";
	import type { SvelteHTMLElements } from "svelte/elements";
	import { resolve } from "$app/paths";
	import PanelHeader from "#lib/components/repo/PanelHeader.svelte";

	interface Props {
		title: string;
		href?: string;
		icon: Component<SvelteHTMLElements["svg"]>;
		count?: number;
		class?: string;
		headerClass?: string;
		bodyClass?: string;
		clamp?: boolean;
		children: Snippet;
	}

	let {
		title,
		href,
		icon,
		count,
		class: className,
		headerClass,
		bodyClass,
		clamp = false,
		children
	}: Props = $props();
</script>

<section
	class={[
		"flex min-w-0 flex-col gap-sm p-md",
		clamp && "md:h-0 md:min-h-full md:has-[details[open]]:h-auto",
		className
	]}
>
	<div class={["flex items-center gap-xs", headerClass]}>
		{#if href}
			<a
				href={resolve(href as "/")}
				class="group no-underline hover:no-underline focus-visible:outline-2 focus-visible:outline-border-focus"
			>
				<PanelHeader {title} {icon} {count} />
			</a>
		{:else}
			<PanelHeader {title} {icon} {count} />
		{/if}
	</div>
	<div class={[clamp && "min-h-0 flex-1", bodyClass]}>
		{@render children()}
	</div>
</section>