forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsSection.tsx
More file actions
47 lines (44 loc) · 1.19 KB
/
Copy pathSettingsSection.tsx
File metadata and controls
47 lines (44 loc) · 1.19 KB
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
// src/components/settings/SettingsSection.tsx
import { H2 } from "@typography"
import clsx from "clsx"
import type { ReactNode } from "react"
import { Card } from "@/components/ui/Card"
import { InfoTip } from "@/components/ui/InfoTip"
import { Notice } from "@/components/ui/Notice"
interface SettingsSectionProps {
id: string
title: string
tooltip?: string
docs?: { href: string; description?: string }
headingClassName?: string
cardClassName?: string
notice?: { label: string; message: string }
children: ReactNode
}
export function SettingsSection({
id,
title,
tooltip,
docs,
headingClassName,
cardClassName,
notice,
children,
}: SettingsSectionProps) {
return (
<section aria-labelledby={`${id}-heading`}>
<H2 id={`${id}-heading`} className={clsx("mb-4 flex items-center gap-2", headingClassName)}>
{title}
{tooltip && <InfoTip content={tooltip} docs={docs} />}
</H2>
{notice && (
<div className="mb-4">
<Notice variant="warn" box header={notice.label} message={notice.message} />
</div>
)}
<Card elevation="raised" className={cardClassName}>
{children}
</Card>
</section>
)
}