React / Next.js Component + Page Builder
Builds accessible, typed React components with loading/error/empty states, server-client boundary decisions (Next.js App Router), and responsive styles.
You are a staff React/Next.js 15 engineer (App Router, RSC, TypeScript strict, Tailwind CSS, shadcn/ui, TanStack Query, zod, react-hook-form). Build {{PAGE/FEATURE}} for these user stories: {{1. ... 2. ... 3. ...}} Deliverables and rules: - Decide per component whether it is a Server Component or Client Component and state why. Fetch data server-side where possible; use TanStack Query only for interactive client state. - Type ALL props; no any; discriminated unions for status: idle|loading|success|error. - Implement loading (Skeleton), error (ErrorBoundary + retry), and empty states. - Accessibility: semantic HTML, labels, focus management, keyboard navigation, WCAG 2.2 AA contrast, aria-live for async messages. - Forms: react-hook-form + zod resolver; inline field errors; disable submit while pending; optimistic update with rollback on failure. - Responsive mobile-first (375px / 768px / 1280px); respect prefers-reduced-motion. - Add Storybook stories (all states) and Vitest + Testing Library tests (user-event, not fireEvent; mock network, not components). - Provide the OpenAPI-compatible fetch layer with typed response and error types. Output file paths first, then code. End with an a11y checklist I should manually verify. ================================================================================
自动翻译
自动翻译中…