22976abe92
- React 18 + Vite + TypeScript + Tailwind CSS setup - AppShell with Sidebar (plugin menu) + TopBar (tenant switcher, search, notifications, user menu) - Auth pages: Login, PasswordResetRequest, PasswordResetConfirm - Protected routes with auth guard - API client (axios with interceptors: session cookie, 401 redirect, 422 validation) - TanStack Query hooks for auth, users, companies, contacts, notifications - Zustand stores: authStore, uiStore - i18n setup (de/en locales) with react-i18next - UI component library: Button, Input, Select, Modal, Toast, Table, Card, Badge, Avatar, Pagination, EmptyState, Skeleton, ConfirmDialog - Accessibility: ARIA labels, 44px touch targets, keyboard nav, reduced-motion, sr-only - Design tokens from prototype as CSS custom properties - 111 tests passing across 20 test files - tsc --noEmit: 0 errors - npm run build: success (471KB JS, 24KB CSS)
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import clsx from 'clsx';
|
|
|
|
export interface SkeletonProps {
|
|
className?: string;
|
|
variant?: 'text' | 'rect' | 'circle';
|
|
width?: string;
|
|
height?: string;
|
|
}
|
|
|
|
export function Skeleton({ className, variant = 'rect', width, height }: SkeletonProps) {
|
|
const variantClass = {
|
|
text: 'rounded',
|
|
rect: 'rounded-md',
|
|
circle: 'rounded-full',
|
|
};
|
|
|
|
return (
|
|
<div
|
|
className={clsx(
|
|
'animate-pulse motion-reduce:animate-none bg-secondary-200',
|
|
variantClass[variant],
|
|
className
|
|
)}
|
|
style={{ width, height }}
|
|
role="status"
|
|
aria-label="Wird geladen"
|
|
/>
|
|
);
|
|
}
|
|
|
|
export function SkeletonText({ lines = 3, className }: { lines?: number; className?: string }) {
|
|
return (
|
|
<div className={clsx('space-y-2', className)} role="status" aria-label="Wird geladen">
|
|
{Array.from({ length: lines }).map((_, i) => (
|
|
<Skeleton
|
|
key={i}
|
|
variant="text"
|
|
className={clsx('h-4', i === lines - 1 && 'w-2/3')}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|