Initial commit
This commit is contained in:
commit
459e93d314
100 files changed
+26594
No files matched your search
@@ -0,0 +1,78 @@
|
||||
import { t } from '../i18n'
|
||||
import type { ReactNode } from 'react'
|
||||
import { cx } from '../lib/utils'
|
||||
|
||||
/** En-tête de page : titre en gras, moitié blanc / moitié rouge. */
|
||||
export function PageHeader({ title, accent, subtitle, action }: { title: string; accent?: string; subtitle?: string; action?: ReactNode }) {
|
||||
return (
|
||||
<header className="flex items-end justify-between gap-3 pb-5 pt-7">
|
||||
<div className="min-w-0">
|
||||
<h1 className="text-[1.9rem] leading-tight">
|
||||
{title}
|
||||
{accent && <span className="text-accent">{accent}</span>}
|
||||
</h1>
|
||||
{subtitle && <p className="mt-1 text-sm text-ink-3">{subtitle}</p>}
|
||||
</div>
|
||||
{action}
|
||||
</header>
|
||||
)
|
||||
}
|
||||
|
||||
export function StatTile({ label, value, hint, className }: { label: string; value: ReactNode; hint?: string; className?: string }) {
|
||||
return (
|
||||
<div className={cx('card p-4', className)}>
|
||||
<div className="eyebrow">{label}</div>
|
||||
<div className="mt-2 text-2xl font-bold leading-none tabular-nums">{value}</div>
|
||||
{hint && <div className="mt-1.5 text-xs text-ink-3">{hint}</div>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** Titre de section façon Letterboxd : petites capitales grises + filet. */
|
||||
export function SectionTitle({ children, action }: { children: ReactNode; action?: ReactNode }) {
|
||||
return (
|
||||
<div className="mb-4 mt-9 flex items-center justify-between gap-3 border-b border-line pb-2">
|
||||
<h2 className="eyebrow text-ink-2">{children}</h2>
|
||||
{action}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function LinkArrow({ onClick, children }: { onClick: () => void; children: ReactNode }) {
|
||||
return (
|
||||
<button onClick={onClick} className="shrink-0 text-xs font-medium text-ink-3 transition-colors hover:text-ink">
|
||||
{children} <span className="text-accent">→</span>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
/** Liste de barres horizontales (une seule série → une seule couleur, valeurs écrites en clair). */
|
||||
export function BarList({ data, format = String }: { data: { label: string; value: number }[]; format?: (v: number) => string }) {
|
||||
const max = Math.max(1, ...data.map((d) => d.value))
|
||||
if (!data.some((d) => d.value > 0)) return <p className="text-sm text-ink-3">{t('common.noData')}</p>
|
||||
return (
|
||||
<ul className="space-y-3">
|
||||
{data.map((d) => (
|
||||
<li key={d.label} className="text-sm" title={`${d.label} : ${format(d.value)}`}>
|
||||
<div className="mb-1.5 flex justify-between gap-2">
|
||||
<span className="truncate text-ink-2">{d.label}</span>
|
||||
<span className="shrink-0 text-xs tabular-nums text-ink">{format(d.value)}</span>
|
||||
</div>
|
||||
<div className="h-1 rounded-full bg-surface-2">
|
||||
<div className="h-full rounded-full bg-accent" style={{ width: `${(d.value / max) * 100}%`, minWidth: d.value ? 4 : 0 }} />
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
export function EmptyState({ title, text, action }: { title: string; text?: string; action?: ReactNode }) {
|
||||
return (
|
||||
<div className="card mt-4 flex flex-col items-center px-6 py-12 text-center">
|
||||
<p className="text-lg font-semibold">{title}</p>
|
||||
{text && <p className="mt-2 max-w-xs text-sm text-ink-2">{text}</p>}
|
||||
{action && <div className="mt-6">{action}</div>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user