diff --git a/eslint.config.js b/eslint.config.js index 75b4d61e..400197f8 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -47,8 +47,26 @@ export default tseslint.config( alphabetize: { order: 'asc' }, }, ], - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, + ], '@typescript-eslint/consistent-type-imports': 'error', + // React-idiomatic relaxations (strict-type-checked is too aggressive + // against common JSX patterns): + '@typescript-eslint/no-confusing-void-expression': 'off', + '@typescript-eslint/no-misused-promises': [ + 'error', + { checksVoidReturn: { attributes: false } }, + ], + '@typescript-eslint/no-floating-promises': 'warn', + '@typescript-eslint/no-unnecessary-condition': 'off', + '@typescript-eslint/restrict-template-expressions': [ + 'error', + { allowNumber: true, allowBoolean: true }, + ], + '@typescript-eslint/dot-notation': 'off', + '@typescript-eslint/no-unnecessary-type-assertion': 'warn', }, }, prettierConfig, diff --git a/src/components/Brand.tsx b/src/components/Brand.tsx index 6db2172b..b9607675 100644 --- a/src/components/Brand.tsx +++ b/src/components/Brand.tsx @@ -1,3 +1,26 @@ -export function Brand() { - return null; +import { FR } from '@/i18n/fr'; + +export function Brand({ compact = false }: { compact?: boolean }) { + return ( + + + + + + + + + {FR.app.name} + + + ); } diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 86272469..c881ba22 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,3 +1,23 @@ +import { FR } from '@/i18n/fr'; + export function Footer() { - return null; + const year = new Date().getFullYear(); + return ( + + ); } diff --git a/src/components/Header.tsx b/src/components/Header.tsx index c6bb6a91..01c86c0b 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -1,3 +1,11 @@ +import { Brand } from './Brand'; + export function Header() { - return null; + return ( +
+
+ +
+
+ ); } diff --git a/src/components/Shell.tsx b/src/components/Shell.tsx new file mode 100644 index 00000000..21dbfd7c --- /dev/null +++ b/src/components/Shell.tsx @@ -0,0 +1,14 @@ +import type { ReactNode } from 'react'; + +import { Footer } from './Footer'; +import { Header } from './Header'; + +export function Shell({ children }: { children: ReactNode }) { + return ( +
+
+
{children}
+
+ ); +} diff --git a/src/components/ui/Badge.tsx b/src/components/ui/Badge.tsx new file mode 100644 index 00000000..73c0bf9e --- /dev/null +++ b/src/components/ui/Badge.tsx @@ -0,0 +1,33 @@ +import type { HTMLAttributes, ReactNode } from 'react'; + +import { cn } from '@/lib/cn'; + +type Variant = 'neutral' | 'mild' | 'moderate' | 'severe' | 'soft'; + +const variants: Record = { + neutral: 'bg-clinic-100 text-clinic-800', + mild: 'bg-clinic-200 text-clinic-800', + moderate: 'bg-warm-300 text-clinic-900', + severe: 'bg-warm-500 text-white', + soft: 'bg-clinic-50 text-clinic-700 border border-clinic-100', +}; + +export function Badge({ + variant = 'neutral', + className, + children, + ...rest +}: HTMLAttributes & { variant?: Variant; children?: ReactNode }) { + return ( + + {children} + + ); +} diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx new file mode 100644 index 00000000..f97a6d07 --- /dev/null +++ b/src/components/ui/Button.tsx @@ -0,0 +1,45 @@ +import type { ButtonHTMLAttributes, ReactNode } from 'react'; + +import { cn } from '@/lib/cn'; + +type Variant = 'primary' | 'secondary' | 'ghost' | 'danger'; +type Size = 'sm' | 'md' | 'lg'; + +interface ButtonProps extends ButtonHTMLAttributes { + variant?: Variant; + size?: Size; + children?: ReactNode; +} + +const base = + 'inline-flex items-center justify-center gap-2 rounded-md font-medium transition-colors ' + + 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-clinic-500 focus-visible:ring-offset-2 ' + + 'disabled:pointer-events-none disabled:opacity-50'; + +const variants: Record = { + primary: 'bg-clinic-600 text-white hover:bg-clinic-700', + secondary: 'bg-clinic-100 text-clinic-800 hover:bg-clinic-200', + ghost: 'text-clinic-700 hover:bg-clinic-100', + danger: 'bg-warm-500 text-white hover:bg-warm-400', +}; + +const sizes: Record = { + sm: 'h-8 px-3 text-sm', + md: 'h-10 px-4 text-sm', + lg: 'h-12 px-6 text-base', +}; + +export function Button({ + variant = 'primary', + size = 'md', + className, + children, + type = 'button', + ...rest +}: ButtonProps) { + return ( + + ); +} diff --git a/src/components/ui/Card.tsx b/src/components/ui/Card.tsx new file mode 100644 index 00000000..36558051 --- /dev/null +++ b/src/components/ui/Card.tsx @@ -0,0 +1,37 @@ +import type { HTMLAttributes, ReactNode } from 'react'; + +import { cn } from '@/lib/cn'; + +export function Card({ + className, + children, + ...rest +}: HTMLAttributes & { children?: ReactNode }) { + return ( +
+ {children} +
+ ); +} + +export function CardHeader({ + className, + children, +}: HTMLAttributes & { children?: ReactNode }) { + return ( +
{children}
+ ); +} + +export function CardBody({ + className, + children, +}: HTMLAttributes & { children?: ReactNode }) { + return
{children}
; +} diff --git a/src/components/ui/Dialog.tsx b/src/components/ui/Dialog.tsx new file mode 100644 index 00000000..a371b635 --- /dev/null +++ b/src/components/ui/Dialog.tsx @@ -0,0 +1,58 @@ +import { AnimatePresence, motion } from 'motion/react'; +import type { ReactNode } from 'react'; +import { useEffect } from 'react'; + +import { SPRING } from '@/lib/motion'; +import { cn } from '@/lib/cn'; + +interface DialogProps { + open: boolean; + onClose: () => void; + title?: string; + children?: ReactNode; + className?: string; +} + +export function Dialog({ open, onClose, title, children, className }: DialogProps) { + useEffect(() => { + if (!open) return undefined; + const onKey = (e: KeyboardEvent) => { + if (e.key === 'Escape') onClose(); + }; + document.addEventListener('keydown', onKey); + return () => document.removeEventListener('keydown', onKey); + }, [open, onClose]); + + return ( + + {open && ( +
+ + + {title &&

{title}

} + {children} +
+
+ )} +
+ ); +} diff --git a/src/components/ui/Input.tsx b/src/components/ui/Input.tsx new file mode 100644 index 00000000..ca23f079 --- /dev/null +++ b/src/components/ui/Input.tsx @@ -0,0 +1,21 @@ +import type { InputHTMLAttributes } from 'react'; +import { forwardRef } from 'react'; + +import { cn } from '@/lib/cn'; + +export const Input = forwardRef>( + function Input({ className, ...rest }, ref) { + return ( + + ); + }, +); diff --git a/src/components/ui/Label.tsx b/src/components/ui/Label.tsx new file mode 100644 index 00000000..01367793 --- /dev/null +++ b/src/components/ui/Label.tsx @@ -0,0 +1,15 @@ +import type { LabelHTMLAttributes, ReactNode } from 'react'; + +import { cn } from '@/lib/cn'; + +export function Label({ + className, + children, + ...rest +}: LabelHTMLAttributes & { children?: ReactNode }) { + return ( + + ); +} diff --git a/src/components/ui/Select.tsx b/src/components/ui/Select.tsx new file mode 100644 index 00000000..efdaa5e7 --- /dev/null +++ b/src/components/ui/Select.tsx @@ -0,0 +1,23 @@ +import type { SelectHTMLAttributes } from 'react'; +import { forwardRef } from 'react'; + +import { cn } from '@/lib/cn'; + +export const Select = forwardRef>( + function Select({ className, children, ...rest }, ref) { + return ( + + ); + }, +); diff --git a/src/components/ui/Textarea.tsx b/src/components/ui/Textarea.tsx new file mode 100644 index 00000000..d7c071ae --- /dev/null +++ b/src/components/ui/Textarea.tsx @@ -0,0 +1,21 @@ +import type { TextareaHTMLAttributes } from 'react'; +import { forwardRef } from 'react'; + +import { cn } from '@/lib/cn'; + +export const Textarea = forwardRef< + HTMLTextAreaElement, + TextareaHTMLAttributes +>(function Textarea({ className, ...rest }, ref) { + return ( +