# Table Styles Migration Guide This guide helps migrate from the old scattered table styles to the new consolidated table system. ## Overview The new consolidated table system provides: - A single base `.table` class with all common styles - Modifier classes for variations (hover, striped, compact, etc.) - Consistent spacing and colors using CSS variables - Better dark mode support - Mobile-responsive options ## Migration Steps ### 1. Include the new CSS file Add to your base template (layout.html): ```html ``` ### 2. Update Table Classes #### Basic Tables **Old:** ```html
``` **New:** ```html
``` #### Time Entries Table **Old:** ```html
``` **New:** ```html
``` #### Admin Tables **Old:** ```html
``` **New:** ```html
``` ### 3. Add Container Classes Wrap tables in proper containers for better styling: ```html
``` ### 4. Update Table Components #### Actions Column **Old:** ```html
``` **New:** ```html
``` #### Status Badges **Old:** ```html Active ``` **New:** ```html Active ``` ### 5. Mobile Optimization For better mobile display, add data attributes: ```html
John Doe john@example.com Active
``` ## Available Modifier Classes ### Base Modifiers - `.table--hover` - Adds hover effect to rows - `.table--striped` - Alternating row colors - `.table--bordered` - Adds borders to all cells - `.table--compact` - Reduces padding - `.table--sm` - Smaller font size - `.table--fixed` - Fixed table layout ### Specialized Modifiers - `.table--time-entries` - Time tracking table styling - `.table--admin` - Admin panel tables - `.table--data` - Data-heavy tables - `.table--mobile-stack` - Stacks on mobile ### Responsive Options - `.table-responsive` - Horizontal scroll on small screens - `.table--scroll-body` - Fixed header with scrollable body ## Examples ### Basic Data Table ```html
Name Email Actions
John Doe john@example.com
``` ### Time Entries Table ```html
Date Time Duration Project
15 JAN 09:00 - 17:00 8h 00m TimeTrack Development
``` ### Mobile-Friendly Table ```html
User Role Status Actions
Jane Smith Administrator Active
``` ## Removing Old Styles Once migration is complete, the following CSS can be removed: 1. From `style.css`: - `.data-table` definitions (lines 1510-1537) - `.users-table, .projects-table` definitions (lines 1286-1313) - `.time-history` definitions (lines 788-815) 2. From `time-tracking.css`: - `.entries-table` definitions (lines 334-355) 3. From dark mode CSS: - Individual table class overrides can be simplified ## Testing Checklist - [ ] All tables display correctly in light mode - [ ] All tables display correctly in dark mode - [ ] Hover effects work - [ ] Mobile responsiveness works - [ ] Table actions are clickable - [ ] Badges and status indicators display correctly - [ ] No visual regressions from previous implementation