12 KiB
Frontend System Current State
1. UI primitive source of truth
The current primitive source of truth is:
components/ui/button.tsxcomponents/ui/card.tsxcomponents/ui/app-card.tsxcomponents/ui/input.tsxcomponents/ui/textarea.tsxcomponents/ui/select.tsxcomponents/ui/dialog.tsxcomponents/ui/sheet.tsxcomponents/ui/tabs.tsxcomponents/ui/dropdown-menu.tsxcomponents/ui/accordion.tsxcomponents/ui/badge.tsxcomponents/ui/checkbox.tsxcomponents/ui/table.tsxcomponents/ui/label.tsxcomponents/ui/separator.tsx
Feature code currently reuses these primitives directly.
2. Libraries currently used for UI, motion, icons, and class composition
UI primitives and wrappers:
@radix-ui/react-accordion@radix-ui/react-checkbox@radix-ui/react-dialog@radix-ui/react-dropdown-menu@radix-ui/react-select@radix-ui/react-slot
Motion:
framer-motiontailwindcss-animate
Icons:
lucide-react
Class composition:
class-variance-authorityclsxtailwind-merge
Shared helper:
lib/utils.tscn(...inputs)
Source files:
package.jsonlib/utils.ts
3. Current token system in use
The active semantic token layer is defined in:
app/globals.csstailwind.config.ts
Current color token groups exposed in Tailwind:
backgroundforegroundcardcard-foregroundpopoverpopover-foregroundprimaryprimary-foregroundsecondarysecondary-foregroundmutedmuted-foregroundaccentaccent-foregrounddestructivedestructive-foregroundborderborder-stronginputringsurface.1surface.2surface.3surface.inversebrand.primarybrand.secondarystatus.successstatus.success-softstatus.warningstatus.warning-softsidebar.*
Current tokenized utility usage in shared UI is based on:
bg-cardbg-backgroundbg-surface-2text-card-foregroundtext-foregroundtext-muted-foregroundborder-border/80border-border/70border-inputhover:bg-accent
4. Current radius system in use
Defined in:
app/globals.csstailwind.config.ts
Current radius tokens:
--radius-surface: 24px--radius-nested: 16px--radius-pill: 9999px
Current mapped utilities:
rounded-surfacerounded-nestedrounded-pill
Current shared primitive usage:
- surface containers:
rounded-surfacecomponents/ui/card.tsxcomponents/ui/app-card.tsxcomponents/ui/dialog.tsxcomponents/ui/select.tsxcomponents/ui/tabs.tsx
- controls and nested blocks:
rounded-nestedcomponents/ui/button.tsxcomponents/ui/input.tsxcomponents/ui/textarea.tsxcomponents/ui/select.tsxcomponents/ui/dialog.tsxcomponents/ui/sheet.tsx
- pill controls:
rounded-pillcomponents/layout/site-header.tsxcomponents/layout/floating-preferences.tsx
5. Current surface/card/panel rules in use
Base Card
Source:
components/ui/card.tsx
Current base rule:
rounded-surface border border-border/80 bg-card text-card-foreground shadow-card
AppCard
Source:
components/ui/app-card.tsx
Current visual levels:
level={1}border border-border/80 bg-card text-card-foreground shadow-card
level={2}border border-input bg-background text-foreground shadow-xs
level={3}border border-border/80 bg-surface-2 text-foreground shadow-panel
level="inverse"border-transparent bg-foreground text-background shadow-card
Current padding variants:
nonesmp-4
mdp-6
lgp-8
Current interactive rule:
hover:bg-accent/30 hover:text-accent-foreground
Current surface usage in feature code
Nested surface blocks currently reuse AppCard directly in:
components/root/media-field-picker.tsxcomponents/root/portfolio-projects-overview.tsxcomponents/root/portfolio-project-form.tsxcomponents/root/portfolio-categories-manager.tsxcomponents/root/site-settings-form.tsx
6. Current input/button/select/dialog/sheet rules in use
Button
Source:
components/ui/button.tsx
Base:
inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-nested text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
Current variants:
defaultbg-primary text-primary-foreground shadow-sm hover:bg-primary/92
secondarybg-secondary text-secondary-foreground hover:bg-secondary/90
outlineborder border-input bg-background hover:border-border-strong hover:bg-accent hover:text-accent-foreground
ghosttext-muted-foreground hover:bg-muted hover:text-foreground
linkrounded-none text-primary underline-offset-4 hover:underline
destructivebg-destructive text-destructive-foreground hover:bg-destructive/90
Current sizes:
defaulth-10 px-4 py-2
smh-9 px-3
lgh-11 px-6
iconh-10 w-10
Input
Source:
components/ui/input.tsx
Current rule:
flex h-10 w-full rounded-nested border border-input bg-background px-3 py-2 text-base text-foreground shadow-xs ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:ring-offset-0
Select
Source:
components/ui/select.tsx
Current trigger rule:
flex h-10 w-full items-center justify-between rounded-nested border border-input bg-background px-3 py-2 text-sm shadow-xs
Current content rule:
rounded-surface border border-input bg-background text-foreground shadow-panel
Current item rule:
rounded-nested ... focus:bg-accent focus:text-accent-foreground
Dialog
Source:
components/ui/dialog.tsx
Current overlay rule:
fixed inset-0 z-50 bg-foreground/30 backdrop-blur-sm
Current content rule:
rounded-surface border border-border/80 bg-card p-6 text-card-foreground shadow-panel
Current close button rule:
inline-flex h-8 w-8 items-center justify-center rounded-nested text-muted-foreground hover:bg-accent hover:text-foreground
Sheet
Source:
components/ui/sheet.tsx
Current overlay rule matches Dialog:
fixed inset-0 z-50 bg-foreground/30 backdrop-blur-sm
Current content rule:
border-border/80 bg-card p-6 text-card-foreground shadow-panel
Current side radius rules:
sm:rounded-l-surfacesm:rounded-r-surfacerounded-b-surfacerounded-t-surface
Tabs
Source:
components/ui/tabs.tsx
Current list rule:
inline-flex ... gap-2 rounded-surface border border-border/80 bg-muted/40 p-1.5
Current trigger rule:
rounded-nested px-3 py-2 text-sm font-medium text-muted-foreground
Current active rule:
border border-border/80 bg-background text-foreground shadow-xs
7. Current layout/container rules in use
Container
Source:
components/layout/container.tsx
Current base container rule:
mx-auto w-full px-4 sm:px-6 lg:px-8
Current size variants:
defaultmax-w-layout
narrowmax-w-narrow
widemax-w-wide
adminmax-w-admin
Shared public chrome
Current shared top controls use:
rounded-pillborder-border/70bg-background/80shadow-panelbackdrop-blur-chrome
Files:
components/layout/site-header.tsxcomponents/layout/floating-preferences.tsx
Admin shell
Current admin layout still uses:
min-h-screen bg-muted/30grid min-h-screen lg:grid-cols-[280px_minmax(0,1fr)]sticky top-0p-4 lg:p-6
Source:
components/dashboard/dashboard-layout.tsx
8. Current spacing rhythm in use
Current repeated spacing values across primitives and layout:
p-4p-6p-8px-3 py-2px-4 py-2px-4 py-3px-4 py-4gap-2gap-3gap-4gap-6space-y-2space-y-3space-y-4space-y-6
Current primitive spacing sources:
CardHeadergap-1.5 p-6
CardContentp-6 pt-0
AppCard padding="sm"p-4
AppCard padding="md"p-6
AppCard padding="lg"p-8
Containerpx-4 sm:px-6 lg:px-8
9. Current motion rules in use
Primary motion library:
framer-motion
State animation utility layer:
tailwindcss-animate
Current motion patterns:
- reveal-on-scroll wrapper
components/motion-fade.tsxinitial: { opacity: 0, y: 20 }whileInView: { opacity: 1, y: 0 }transition: { duration: 0.45, ease: "easeOut" }
- shared overlay open/close classes
dialogsheetselectdropdown-menuaccordion
- animated nav active pill and mobile menu
components/layout/site-header.tsx
10. Current icon rules in use
Current icon library:
lucide-react
Current shared rule:
Icons are imported directly from lucide-react and passed through local primitives or feature components.
Examples:
components/ui/dialog.tsxcomponents/ui/select.tsxcomponents/layout/site-header.tsxcomponents/theme-toggle.tsxcomponents/root/portfolio-project-form.tsx
No second React icon library is currently present in package.json.
11. Current forbidden drift or remaining transitional areas, if any
The shared primitive system is currently tokenized.
Remaining transitional areas still present in the codebase:
- public hero / atmospheric visuals still use raw gradients and
rgba(...)decorative backgroundscomponents/layout/home-hero.tsxcomponents/layout/site-ambient-backdrop.tsxcomponents/layout/hero-atmosphere.tsxcomponents/layout/site-logo.tsx
coming-soonpage still uses older raw translucent chrome stylesapp/[locale]/coming-soon/page.tsx
- some public route-level content blocks still use direct local classes instead of shared primitive wrappers
app/[locale]/(site)/portfolio/page.tsxapp/[locale]/(site)/portfolio/[slug]/page.tsx
- one preview block in site settings still uses a custom dark preview surface
components/root/site-settings-form.tsxbg-slate-950text-white/55text-white/60
These files exist in the current codebase and should be treated as remaining transitional areas, not as shared-system rules.
12. Codex rules derived from the current system
- Use
components/uias the primitive source of truth. - Use
cn()fromlib/utils.tsfor class composition. - Use
cva()where the primitive already exposes variants. - Use semantic tokens already defined in
app/globals.cssand mapped intailwind.config.ts. - Use
Cardfor the base surface:rounded-surface border border-border/80 bg-card text-card-foreground shadow-card
- Use
AppCardwhen feature code needs explicit shared surface levels. - Use
AppCard level={1}for primary card surfaces. - Use
AppCard level={2}for nested panels and inner blocks. - Use
AppCard level={3}for elevated grouped panels. - Use
rounded-surface,rounded-nested, androunded-pillas the shared radius system. - Use
Input,Textarea,Select,Dialog,Sheet, andTabsfromcomponents/uiinstead of re-creating those patterns in feature code. - Use
Containerfor width and horizontal padding rules. - Use
lucide-reactfor icons. - Use
framer-motionfor custom motion andtailwindcss-animatefor primitive state transitions. - Do not treat transitional decorative hero files or remaining route-local raw blocks as shared-system primitives.