hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits
| 1 | import { For, Show, type Component } from "solid-js"; |
| 2 | import { EmptyInline } from "@/components/ui/empty-inline"; |
| 3 | import { IconChevronRight } from "@/components/ui/icons"; |
| 4 | import type { IllustrationName } from "@/lib/illustrations"; |
| 5 | |
| 6 | export type QuickLinkRow = { |
| 7 | id: string; |
| 8 | primary: string; |
| 9 | secondary?: string; |
| 10 | Icon: Component<{ class?: string }>; |
| 11 | }; |
| 12 | |
| 13 | export type QuickLinkColumnProps = { |
| 14 | title: string; |
| 15 | rows: QuickLinkRow[]; |
| 16 | empty: string; |
| 17 | illustration?: IllustrationName; |
| 18 | onOpen: (row: QuickLinkRow) => void; |
| 19 | }; |
| 20 | |
| 21 | /** Figma "Resource Columns" from ADM-01: a subtle column header and a short |
| 22 | * list of resource rows with a trailing caption, each navigating to the |
| 23 | * resource's real detail page. */ |
| 24 | export function QuickLinkColumn(props: QuickLinkColumnProps) { |
| 25 | return ( |
| 26 | <div class="flex min-w-0 flex-1 flex-col rounded-xl border border-border-line bg-surface-base px-4 py-3"> |
| 27 | <p class="pb-2 text-[13px] font-medium text-text-subtle">{props.title}</p> |
| 28 | <Show when={props.rows.length > 0} fallback={<EmptyInline class="border-t border-border-hairline" illustration={props.illustration} title={props.empty} />}> |
| 29 | <For each={props.rows}> |
| 30 | {(row) => ( |
| 31 | <button |
| 32 | type="button" |
| 33 | onClick={() => props.onOpen(row)} |
| 34 | class="flex w-full items-center gap-2.5 border-t border-border-hairline py-2.5 text-left first:border-t-0" |
| 35 | > |
| 36 | <row.Icon class="h-[15px] w-[15px] shrink-0 text-text-subtle" /> |
| 37 | <span class="min-w-0 flex-1 truncate text-sm text-text-default">{row.primary}</span> |
| 38 | <Show when={row.secondary}> |
| 39 | <span class="shrink-0 text-xs text-text-subtle">{row.secondary}</span> |
| 40 | </Show> |
| 41 | <IconChevronRight class="h-3 w-3 shrink-0 text-text-subtle" /> |
| 42 | </button> |
| 43 | )} |
| 44 | </For> |
| 45 | </Show> |
| 46 | </div> |
| 47 | ); |
| 48 | } |