~james/core

core/web/src/lib/components/settings/SettingsSection.svelte -rw-r--r-- 784 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 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
<script lang="ts">
	import type { Snippet } from "svelte";
	import SettingsList from "#lib/components/settings/SettingsList.svelte";

	interface Props {
		title?: string;
		name?: string;
		id?: string;
		headingGap?: "3" | "4";
		framed?: boolean;
		children: Snippet;
	}

	let { title, name, id, headingGap = "3", framed = true, children }: Props = $props();

	const gapClass = $derived(headingGap === "4" ? "gap-md" : "gap-sm");
</script>

<section {id} class="flex w-full flex-col {gapClass}">
	{#if title}
		<h2
			data-testid="settingsSectionTitle"
			data-name={name}
			class="typography-heading-4 text-foreground-default"
		>
			{title}
		</h2>
	{/if}
	{#if framed}
		<SettingsList>
			{@render children()}
		</SettingsList>
	{:else}
		{@render children()}
	{/if}
</section>