9.3 KiB
Extractable UI Components
This document identifies reusable UI components that could be extracted, packaged, and reused across other projects.
Form Components
1. Search Input with Debounce
Source: resources/views/livewire/public/station-search.blade.php (lines 8-16)
Category: Forms
Complexity: Low
Props:
name: Input field namewire:model: Livewire property bindinglabel: Display labelplaceholder: Placeholder text
Features:
- Flux form styling
- Wire model binding support
- Error message display
Extractable: Yes - Generic search input wrapper
2. Multi-Option Select Dropdown
Source: resources/views/livewire/public/station-search.blade.php (lines 20-28, 34-42, 44-52)
Category: Forms
Complexity: Low
Props:
wire:model.liveorwire:model: Bindingname: Field namelabel: Label text- Options as slot
Features:
- Reactive updates via
wire:model.live - Error display
- Multiple select options
Variants:
- Fuel type selector (6 options)
- Radius selector (5 options)
- Sort selector (5 options)
Extractable: Yes - Reusable select component wrapper
3. Form Submission Button with Loading State
Source: resources/views/livewire/public/station-search.blade.php (lines 54-59)
Category: Forms
Complexity: Low
Props:
type: button typevariant: "primary", etc.wire:loading.attr: Disabled state during loadingwire:target: Target action
Features:
- Dynamic text based on loading state
- Wire loading indicators
- Primary variant styling
Extractable: Yes - Generic loading button component
Data Display Components
4. Station Result Card
Source: resources/views/livewire/public/station-search.blade.php (lines 94-128)
Category: Data Display
Complexity: Medium
Props:
station: Object with station dataname: Station nameaddress: Street addresspostcode: Postcodedistance_km: Distance in kilometersprice: Fuel price in penceprice_classification: One of (current, recent, stale, outdated)price_classification_label: Human labelprice_updated_at: ISO date stringis_supermarket: Boolean
Features:
- Responsive layout (flex items-center justify-between)
- Color-coded price based on freshness
- Supermarket badge display
- Distance/address display
- Time-ago formatting
Extractable: Yes - Could be standalone component for displaying station data
5. Results Count Summary
Source: resources/views/livewire/public/station-search.blade.php (lines 72-76)
Category: Data Display
Complexity: Low
Props:
count: Total stations foundlowest_pence: Lowest price in penceavg_pence: Average price in pence
Features:
- Formatted currency display
- Singular/plural handling
- Stats display on one line
Extractable: Yes - Generic stats summary component
6. Classification Legend/Color Code Guide
Source: resources/views/livewire/public/station-search.blade.php (lines 84-90)
Category: Data Display
Complexity: Low
Props:
- Array of classification items with colors and labels
Features:
- Inline color swatches
- Legend item labels
- Responsive flex layout
Extractable: Yes - Reusable legend component
Navigation Components
7. Settings Sidebar Navigation
Source: resources/views/pages/settings/layout.blade.php (lines 3-7)
Category: Navigation
Complexity: Low
Props:
- Navigation items array with:
label: Display textroute: Route nameicon: Optional icon name
Features:
- flux:navlist component
- wire:navigate support
- Active state detection
- Mobile/desktop responsive
Extractable: Yes - Generic sidebar nav for multi-section pages
8. User Profile Dropdown Menu
Source: resources/views/components/desktop-user-menu.blade.php
Category: Navigation
Complexity: Medium
Props:
- User object with:
name: User nameemail: User emailinitials(): Method to get initials
Features:
- Flux dropdown + menu
- Avatar display with initials
- Settings link
- Logout form with CSRF
- Test attributes for QA
Extractable: Yes - Standalone user menu component for authenticated apps
Layout Components
9. Centered Authentication Layout Container
Source: resources/views/layouts/auth/simple.blade.php
Category: Layouts
Complexity: Low
Props:
- None (slot-based)
Features:
- Centered flex layout
- Max-width constraint (sm)
- Dark gradient background
- Logo link at top
- Responsive padding
Extractable: Yes - Generic centered auth layout
10. Card-Based Form Container
Source: resources/views/layouts/auth/card.blade.php
Category: Layouts
Complexity: Low
Props:
- None (slot-based)
Features:
- White card on dark background
- Rounded borders with shadow
- Dark mode support
- Centered with max-width
- Padding inside card
Extractable: Yes - Modal/card wrapper component
11. Split-Screen Auth Layout
Source: resources/views/layouts/auth/split.blade.php
Category: Layouts
Complexity: Medium
Props:
- Quote display (generated from Inspiring::quotes)
Features:
- Two-column grid (desktop only)
- Dark sidebar with quote/branding
- Form content on right
- Mobile-friendly (single column)
- Absolute background fill
Extractable: Yes - Premium auth layout component
Status/Feedback Components
12. Temporary Action Message
Source: resources/views/components/action-message.blade.php
Category: Feedback
Complexity: Low
Props:
on: Livewire event to listen to- Slot for custom message (defaults to "Saved.")
Features:
- Alpine.js event listener
- Auto-hide after 2 seconds
- Fade transition
- Livewire integration
Extractable: Yes - Generic toast/message component
13. Session Status Message
Source: resources/views/components/auth-session-status.blade.php
Category: Feedback
Complexity: Low
Props:
status: Status message text
Features:
- Conditional rendering
- Green success styling
- Used in auth forms
Extractable: Yes - Simple status display component
Map/Visualization Components
14. Leaflet Map Integration
Source: resources/js/maps/station-map.js
Category: Map/Visualization
Complexity: High
Props:
results: Array of station data with lat/lng/classifications
Features:
- Leaflet map initialization
- OpenStreetMap tiles
- Custom circle markers with colors
- Popup on marker click
- Auto-fit bounds
- Reactive to data changes
Extractable: Yes - Could be abstracted into reusable Leaflet component
Note: Currently tightly coupled to Alpine.js and station data structure. Would require prop mapping for reuse.
Typography/Header Components
15. Auth Page Header
Source: resources/views/components/auth-header.blade.php
Category: Typography
Complexity: Low
Props:
title: Main headingdescription: Subheading
Features:
- Centered text
- Flux typography (heading + subheading)
- Used on all auth pages
Extractable: Yes - Generic header for centered pages
16. Settings Page Header
Source: resources/views/partials/settings-heading.blade.php
Category: Typography
Complexity: Low
Props:
- None (hardcoded for settings)
Features:
- Page title "Settings"
- Subheading text
- Separator line
Extractable: Maybe - Specific to settings but pattern is reusable
Reusability Summary Table
| Component | Type | Complexity | Reusable | Dependencies | Extraction Cost |
|---|---|---|---|---|---|
| Search Input | Form | Low | High | Flux | Very Low |
| Select Dropdown | Form | Low | High | Flux | Very Low |
| Loading Button | Form | Low | High | Flux, Livewire | Very Low |
| Station Card | Display | Medium | High | Flux | Low |
| Stats Summary | Display | Low | High | None | Very Low |
| Legend | Display | Low | High | Tailwind | Very Low |
| Settings Nav | Nav | Low | High | Flux | Very Low |
| User Menu | Nav | Medium | High | Flux, Auth | Low |
| Simple Auth Layout | Layout | Low | High | Tailwind | Very Low |
| Card Container | Layout | Low | High | Tailwind | Very Low |
| Split Layout | Layout | Medium | High | Tailwind | Low |
| Action Message | Feedback | Low | High | Alpine, Livewire | Very Low |
| Status Message | Feedback | Low | High | None | Very Low |
| Leaflet Map | Visualization | High | Medium | Leaflet, Alpine | Medium |
| Auth Header | Typography | Low | High | Flux | Very Low |
| Settings Header | Typography | Low | Medium | Flux | Very Low |
Top Candidates for Extraction
- Search Input Component - Generic, simple, widely useful
- Station Card Component - Good showcase of complex data display
- User Menu Component - Authentication pattern, widely needed
- Loading Button Component - Form UX pattern, commonly needed
- Simple Auth Layout - Authentication flows are common
Framework Package Recommendations
If extracting these components into a package:
- Make them framework-agnostic (or have adapters)
- Ensure Flux/Livewire are peer dependencies
- Document required Alpine.js versions
- Provide TypeScript declarations for props
- Include Storybook examples
- Consider CSS-in-JS vs Tailwind integration