forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiBdcf123aBurak Boduroğlu2 months ago674 commits

stat-tile.tsx28 lines, 1.1 KiBHistoryRawDownload
1import type { Component } from "solid-js";
2import { Show } from "solid-js";
3
4export type StatTileProps = {
5 label: string;
6 value: string;
7 caption?: string;
8 Icon: Component<{ class?: string }>;
9};
10
11/** Figma "Web / Stat Tile": subtle label + icon on top, a large value, an
12 * optional plain-text caption below. No delta arrow is drawn here — this
13 * project has no historical baseline to diff against, and a fabricated trend
14 * is worse than none. */
15export function StatTile(props: StatTileProps) {
16 return (
17 <div class="flex flex-col gap-1.5 rounded-xl border border-border-line bg-surface-base px-4 py-3.5 shadow-sm">
18 <div class="flex items-center gap-2">
19 <p class="min-w-0 flex-1 truncate text-[13px] font-medium text-text-subtle">{props.label}</p>
20 <props.Icon class="h-[13px] w-[13px] shrink-0 text-text-subtle" />
21 </div>
22 <p class="tabular-nums text-[26px] font-semibold leading-8 tracking-[-0.02em] text-text-strong">{props.value}</p>
23 <Show when={props.caption}>
24 <p class="truncate text-[13px] text-text-subtle">{props.caption}</p>
25 </Show>
26 </div>
27 );
28}