forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

collapsible-help.tsx35 lines, 1.4 KiBHistoryRawDownload
1import { Collapsible } from "@kobalte/core/collapsible";
2import type { ParentProps } from "solid-js";
3import { IconChevronDown, IconGuide } from "@/components/ui/icons";
4import { cn } from "@/lib/cn";
5
6/** shadcn-style collapsible help — always starts closed. */
7export function CollapsibleHelp(
8 props: ParentProps<{
9 title: string;
10 class?: string;
11 }>,
12) {
13 return (
14 <Collapsible class={cn("group/help rounded-md border bg-card text-card-foreground shadow-xs", props.class)}>
15 <Collapsible.Trigger
16 class={cn(
17 "flex w-full items-center gap-3 px-4 py-3 text-left text-sm font-medium outline-hidden transition-colors",
18 "hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring",
19 "ui-expanded:border-b ui-expanded:border-border",
20 )}
21 >
22 <span class="flex h-7 w-7 shrink-0 items-center justify-center rounded-md border bg-muted text-muted-foreground">
23 <IconGuide class="h-3.5 w-3.5" />
24 </span>
25 <span class="flex-1">{props.title}</span>
26 <IconChevronDown class="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 group-data-expanded/help:rotate-180" />
27 </Collapsible.Trigger>
28 <Collapsible.Content>
29 <div class="border-t border-border px-4 py-3 text-sm leading-relaxed text-muted-foreground">
30 {props.children}
31 </div>
32 </Collapsible.Content>
33 </Collapsible>
34 );
35}