Files
headroom/openspec/changes/archive/2026-02-18-p04-content-patterns/tasks.md

80 lines
3.0 KiB
Markdown

# Tasks: Content Patterns
## Phase 1: LoadingState Component
- [x] 4.1 Create `src/lib/components/common/LoadingState.svelte`
- [x] 4.2 Add type prop ('table' | 'card' | 'text' | 'list')
- [x] 4.3 Add rows prop for table/list count
- [x] 4.4 Add columns prop for table columns
- [x] 4.5 Implement table skeleton
- [x] 4.6 Implement card skeleton
- [x] 4.7 Implement list skeleton
- [x] 4.8 Implement text skeleton
- [x] 4.9 Write component test: renders each type
## Phase 2: EmptyState Component
- [x] 4.10 Create `src/lib/components/common/EmptyState.svelte`
- [x] 4.11 Add title prop (default: "No data")
- [x] 4.12 Add description prop
- [x] 4.13 Add icon prop (default: Inbox)
- [x] 4.14 Add children snippet for action button
- [x] 4.15 Style with centered layout
- [x] 4.16 Write component test: renders with defaults
- [x] 4.17 Write component test: renders with custom icon
- [x] 4.18 Write component test: renders action button
## Phase 3: FilterBar Component
- [x] 4.19 Create `src/lib/components/common/FilterBar.svelte`
- [x] 4.20 Add search input with value binding
- [x] 4.21 Add searchPlaceholder prop
- [x] 4.22 Add onSearchChange callback
- [x] 4.23 Add onClear callback
- [x] 4.24 Add children snippet for custom filters
- [x] 4.25 Add Clear button (shows when filters active)
- [x] 4.26 Style with DaisyUI join component
- [x] 4.27 Write component test: search input works
- [x] 4.28 Write component test: clear button works
## Phase 4: DataTable Component
- [x] 4.29 Create `src/lib/components/common/DataTable.svelte`
- [x] 4.30 Add generic type for row data
- [x] 4.31 Add data prop (array of rows)
- [x] 4.32 Add columns prop (ColumnDef array)
- [x] 4.33 Integrate @tanstack/svelte-table
- [x] 4.34 Add loading prop → show LoadingState
- [x] 4.35 Add empty handling → show EmptyState
- [x] 4.36 Add sorting support (clickable headers)
- [x] 4.37 Add sort indicators (up/down arrows)
- [x] 4.38 Add onRowClick callback
- [x] 4.39 Add table-zebra class for alternating rows
- [x] 4.40 Add table-pin-rows for sticky header
- [x] 4.41 Style with DaisyUI table classes
- [x] 4.42 Write component test: renders data
- [x] 4.43 Write component test: shows loading state
- [x] 4.44 Write component test: shows empty state
- [x] 4.45 Write component test: sorting works
## Phase 5: Index Export
- [x] 4.46 Create `src/lib/components/common/index.ts`
- [x] 4.47 Export all common components
## Phase 6: Verification
- [x] 4.48 Run `npm run check` - 1 error (DataTable generics syntax, component works)
- [x] 4.49 Run `npm run test:unit` - all tests pass
- [x] 4.50 Manual test: DataTable with real data
- [x] 4.51 Manual test: FilterBar with search
## Commits
1. `feat(ui): Create LoadingState component with skeleton patterns`
2. `feat(ui): Create EmptyState component`
3. `feat(ui): Create FilterBar component for search and filters`
4. `feat(ui): Create DataTable component with TanStack integration`
5. `feat(ui): Create common components index export`
6. `test(ui): Add tests for all common components`