Build & Push Docker Image / build (push) Has been cancelled
Refresh the homepage around new hero/services/roadmap sections, shared design tokens, and updated brand assets. Co-authored-by: Cursor <cursoragent@cursor.com>
2.8 KiB
2.8 KiB
Coding Rules
Conventions for UI code in this Next.js (App Router) + Tailwind v4 + Shadcn codebase.
Stack assumptions
- React 19 + Next.js 16 App Router
- Tailwind CSS v4 (
@import "tailwindcss"inglobals.css) - CVA +
cn()(clsx+tailwind-merge) - Radix-based Shadcn primitives in
components/ui/ - Motion library:
motion/react - Themes:
next-themesclass strategy - Locale: Persian RTL by default
Always
- Follow
docs/design-system/*and.cursor/rules/*. - Reuse design tokens (CSS variables + Tailwind semantic colors).
- Use
<Container>/layout.*for page sections. - Use
type.*or<Typography>for text styles. - Use shared
ButtonandCardcomponents. - Support light and dark themes without hardcoding surfaces.
- Preserve responsive behavior (mobile first).
- Preserve accessibility (focus, labels, reduced motion).
- Prefer semantic HTML and Radix patterns already in the repo.
- Keep components focused; extract when a pattern repeats twice+.
Never
- Create another content container / max-width system.
- Hardcode colors (
#29a19c,rgb(…),text-gray-700) in UI. - Invent spacing outside the scale.
- Duplicate Button/Card/Input styles.
- Ship unadapted Shadcn/Tailark blocks.
- Introduce inconsistent radii/shadows/hover timings.
- Animate layout properties when transform suffices.
- Commit secrets or environment files.
- Add heavy dependencies for trivial UI.
- Bypass ESLint without cause.
File organization
| Kind | Location |
|---|---|
| Page routes | app/** |
| Marketing sections | components/*.tsx |
| Primitives | components/ui/* |
| Layout tokens | lib/layout.ts |
| Typography tokens | lib/typography.ts |
| Global CSS / theme | app/globals.css |
Name section files descriptively (services-14.tsx) or by domain (footer.tsx). Avoid NewSection2.tsx.
Class composition
import { cn } from "@/lib/utils";
className={cn(
"section-shell bg-section-canvas",
layout.sectionY,
className
)}
- Put conditional classes in
cn. - Do not string-concatenate Tailwind classes manually.
- Prefer extending variants via CVA for reusable primitives.
Imports
Use @/ alias. Keep import groups tidy: external → @/components → @/lib → local.
Client vs server
- Default Server Components.
- Add
"use client"only for hooks, browser APIs, or motion/theme interactivity. - Keep presentational children server-friendly when possible.
State & data
- Follow existing form patterns (
react-hook-form+ zod). - Do not fetch in deeply nested presentational components if a parent already owns data.
Comments
- Comment only non-obvious intent (animation thresholds, RTL quirks, token constraints).
- Do not narrate obvious JSX.