Glassmorphism Design System Implementation
ποΈ Component Architecture
The admin panel follows a component separation pattern to maintain clean architecture:π Component Categories
1. UI Primitives (packages/ui/src/components/ui/)
Purpose: Reusable design system components with no business logic
Examples:
Button,Card,Badge,AvatarGlassButton,GlassCard(styled variants)Input,SearchBar,Table,ProgressBar
- β Generic and reusable
- β No domain-specific data
- β Style and interaction focused
- β Can be used across any page
2. Layout Components (packages/ui/src/components/layout/)
Purpose: Structural components for page layout
Examples:
MainLayout- Main page wrapperSidebar- Navigation sidebarNavbar- Top navigation bar
- β Define page structure
- β Handle navigation
- β Responsive layouts
3. Page-Specific Components (apps/panel/src/components/pages/)
Purpose: Domain logic and page-specific features
Examples:
StatCard- Dashboard statistics with trendsDepartmentUsage- HR department metricsUpcomingHolidays- Holiday calendar widgetProtectedRoute- Auth route wrapper
- β Contains business logic
- β Uses domain-specific data
- β Organized by feature/page
- β
Imports UI primitives from
@monorepo/solid-pkg-ui
β Completed Components
Global Theme
- β
packages/ui/src/styles/theme.css- CSS custom properties for colors, spacing, shadows
- Glassmorphism effects
- Dark mode support
- Custom scrollbar styling
- Animation utilities
Layout Components
- β
MainLayout.tsx- Main page wrapper with sidebar + navbar - β
Sidebar.tsx- Navigation with sections, badges, icons - β
Navbar.tsx- Search bar, theme toggle, notifications, user menu
UI Primitives
- β
Button.tsx- Variants: primary, secondary, outline, ghost, etc. - β
Card.tsx- CardHeader, CardBody, CardFooter subcomponents - β
Badge.tsx- Status badges with variants - β
Avatar.tsx- User avatars with fallbacks - β
Input.tsx- Form inputs with validation states - β
SearchBar.tsx- Search input with glass effect - β
Table.tsx- Data table with hover effects - β
ProgressBar.tsx- Progress indicators - β
HolidayCard.tsx- Calendar date display - β
GlassButton.tsx- Glassmorphism button variant - β
GlassCard.tsx- Glassmorphism card variant
Page-Specific Components
- β
StatCard.tsx- Dashboard statistics with trend indicators - β
DepartmentUsage.tsx- Department leave usage widget - β
UpcomingHolidays.tsx- Holiday calendar widget - β
ProtectedRoute.tsx- Authentication route guard
π¨ Color System
π¦ Icon Library (solid-icons)
| Icon Component | Usage |
|---|---|
TbDashboard | Dashboard |
TbUsers | Employees |
TbCalendarEvent | Leave Requests |
TbCalendar | Calendar |
TbChartBar | Reports |
TbUserGroup | User Groups |
TbSettings | Settings |
TbLogout | Logout |
TbSearch | Search |
TbBell | Notifications |
TbMoon/TbSun | Theme Toggle |
TbMenu2 | Mobile Menu |
TbLeaf | Company Logo |
TbTrendingUp | Stats Increase |
TbAlertCircle | Warning |
TbClock | Pending |
TbBeach | Vacation |
TbCircleCheck | Approved |
TbCheck | Approve Action |
TbX | Reject Action |
TbDotsVertical | More Options |
π― Usage Guidelines
When to Create a UI Primitive
Create a component inpackages/ui/src/components/ui/ when:
- β Itβs a generic, reusable design element
- β It has no business logic or domain data
- β It can be used across multiple pages
- β Itβs part of the design system
When to Create a Page Component
Create a component inapps/panel/src/components/pages/[feature]/ when:
- β It contains domain-specific logic
- β It uses business data (e.g., statistics, department info)
- β Itβs specific to a particular page or feature
- β It combines multiple UI primitives
Import Patterns
π‘ Design Principles
1. Glassmorphism
- Frosted glass effect with backdrop blur
- Semi-transparent backgrounds
- Layered depth with shadows
- Border highlights
2. Micro-interactions
- Scale animations on hover
- Smooth transitions (300ms duration)
- Backdrop blur effects
- Color shifts on interaction
3. Dark Mode
- Automatic system preference detection
- Persistent storage
- Smooth transitions
- Optimized contrast ratios
4. Accessibility
- ARIA labels on all interactive elements
- Keyboard navigation support
- Focus indicators
- Screen reader compatibility
5. Responsive Design
- Mobile-first approach
- Tailwind breakpoints (sm, md, lg, xl)
- Touch-friendly targets (min 44x44px)
- Collapsible sidebar on mobile
π Adding New Components
For UI Primitives:
- Create component in
packages/ui/src/components/ui/[ComponentName].tsx - Add export to
packages/ui/src/components/ui/index.ts - Add export to
packages/ui/src/index.ts - Document props and usage
For Page Components:
- Create component in
apps/panel/src/components/pages/[feature]/[ComponentName].tsx - Add export to
apps/panel/src/components/pages/[feature]/index.ts - Import UI primitives from
@monorepo/solid-pkg-ui - Use in your page routes
π Example: Creating a New Page Component
π§ Utility Functions
cn() - Class Name Utility
Combines Tailwind classes with conditional logic:
clsx and tailwind-merge to handle class name conflicts intelligently.