Add Widget component with Enabel Bootstrap Theme integration and comprehensive documentation #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements a reusable Twig Widget component that visually and structurally aligns with the Enabel Bootstrap Theme Widget design. The component provides configurable dashboard-style widgets for displaying key metrics and navigation elements.
Features
The Widget component supports the following configuration options:
label(string): Display text for the widgetvariant(string): Bootstrap color variant (primary, secondary, success, danger, warning, info, light, dark)icon(string, optional): Symfony UX Icons identifier (e.g., 'lucide:folder')link(string, optional): URL to make the entire widget clickablecount(string, optional): Numerical or textual count to display prominentlyUsage Examples
Basic Widget:
{{ component('Enabel:Ux:Widget', { label: 'Projects', count: '25', variant: 'primary', icon: 'lucide:folder' }) }}Clickable Widget:
{{ component('Enabel:Ux:Widget', { label: 'View Projects', count: '25', variant: 'primary', icon: 'lucide:external-link', link: '/projects' }) }}Status Widget (without count):
{{ component('Enabel:Ux:Widget', { label: 'Status: Active', variant: 'success', icon: 'lucide:check-circle' }) }}Implementation Details
src/Component/Widget.php): Handles configuration validation and default values using Symfony's OptionsResolvertemplates/widget.html.twig): Renders the widget structure with proper CSS classes and icon integrationtemplates/widget/demo.html.twig): Comprehensive documentation with visual examples of all variants and usage patternstests/Component/Widget/WidgetTest.php): 18 test cases covering all configuration options and edge casesdocs/Widget/widget.md): Comprehensive usage guide with examples, best practices, and configuration referenceThe implementation follows existing bundle patterns and uses only Enabel Bootstrap Theme CSS classes without any inline styles or JavaScript.
Documentation
Comprehensive documentation has been added following the existing bundle documentation patterns:
Visual Design
The widgets feature gradient backgrounds, theme-appropriate colors, hover effects with elevation, and responsive design. Each variant uses its corresponding Bootstrap color scheme with a distinctive left border accent.
Testing
The component is production-ready and integrates seamlessly with the existing Enabel UX ecosystem.
Original prompt
Fixes #9
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.