Implemented complete design system and foundational infrastructure: **Design System Components:** - Button (all variants: primary, secondary, ghost, danger) - Input & Textarea (with validation and error states) - Card (elevated, outlined, flat variants) - Modal/Dialog (with focus trap and accessibility) - Avatar (with fallback initials) - Badge (all color variants) - Form helpers (FormField, Checkbox, Select) - Link component with Next.js integration - Navigation (Header, Footer with responsive design) **Layouts:** - MainLayout (with Header/Footer for public pages) - AuthLayout (minimal layout for auth flows) - DashboardLayout (with sidebar navigation) **Hooks & Utilities:** - useAuth() - authentication state management - useApi() - API calls with loading/error states - useLocalStorage() - persistent state management - apiClient - Axios instance with token refresh - authStore - Zustand store for auth state **Configuration:** - Tailwind config with design tokens - Dark mode support via CSS variables - Global styles with accessibility focus - WCAG 2.2 AA+ compliant focus indicators All components follow accessibility best practices with proper ARIA labels, keyboard navigation, and screen reader support. Job ID: MTAD-IMPL-2025-11-18-CL
75 lines
1.6 KiB
TypeScript
75 lines
1.6 KiB
TypeScript
'use client'
|
|
|
|
import React from 'react'
|
|
|
|
export type CardVariant = 'elevated' | 'outlined' | 'flat'
|
|
|
|
export interface CardProps {
|
|
variant?: CardVariant
|
|
className?: string
|
|
padding?: boolean
|
|
children: React.ReactNode
|
|
}
|
|
|
|
export interface CardHeaderProps {
|
|
className?: string
|
|
children: React.ReactNode
|
|
}
|
|
|
|
export interface CardBodyProps {
|
|
className?: string
|
|
children: React.ReactNode
|
|
}
|
|
|
|
export interface CardFooterProps {
|
|
className?: string
|
|
children: React.ReactNode
|
|
}
|
|
|
|
const variantStyles: Record<CardVariant, string> = {
|
|
elevated: 'bg-white dark:bg-gray-800 shadow-md',
|
|
outlined: 'bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700',
|
|
flat: 'bg-gray-50 dark:bg-gray-900',
|
|
}
|
|
|
|
export const Card = ({
|
|
variant = 'elevated',
|
|
className = '',
|
|
padding = true,
|
|
children,
|
|
}: CardProps) => {
|
|
const baseStyles = 'rounded-lg'
|
|
const paddingStyles = padding ? 'p-6' : ''
|
|
|
|
const combinedClassName = `${baseStyles} ${variantStyles[variant]} ${paddingStyles} ${className}`.trim()
|
|
|
|
return (
|
|
<div className={combinedClassName}>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const CardHeader = ({ className = '', children }: CardHeaderProps) => {
|
|
return (
|
|
<div className={`mb-4 ${className}`.trim()}>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const CardBody = ({ className = '', children }: CardBodyProps) => {
|
|
return (
|
|
<div className={className}>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const CardFooter = ({ className = '', children }: CardFooterProps) => {
|
|
return (
|
|
<div className={`mt-4 ${className}`.trim()}>
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|