Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 16, 2025

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 widget
  • variant (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 clickable
  • count (string, optional): Numerical or textual count to display prominently

Usage 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

  • PHP Component (src/Component/Widget.php): Handles configuration validation and default values using Symfony's OptionsResolver
  • Twig Template (templates/widget.html.twig): Renders the widget structure with proper CSS classes and icon integration
  • Demo Page (templates/widget/demo.html.twig): Comprehensive documentation with visual examples of all variants and usage patterns
  • Unit Tests (tests/Component/Widget/WidgetTest.php): 18 test cases covering all configuration options and edge cases
  • Complete Documentation (docs/Widget/widget.md): Comprehensive usage guide with examples, best practices, and configuration reference

The 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:

  • Parameter reference table with all configuration options and defaults
  • Usage examples for common scenarios including dashboard metrics, navigation widgets, and status indicators
  • All variant examples showing every Bootstrap color variant
  • Popular icon examples for different business contexts (analytics, project management, e-commerce)
  • Advanced usage with custom attributes and block content overrides
  • Responsive design guidelines and grid layout examples
  • Accessibility information and best practices
  • CSS classes reference for styling customization
  • Symfony UX Icons integration documentation

Complete Documentation

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.

Widget Visual Demo

Testing

  • All existing tests continue to pass (143/143)
  • 18 new unit tests specifically for the Widget component
  • Code passes PHP CS Fixer and PHPStan analysis
  • Manual testing confirms responsive behavior and accessibility compliance

The component is production-ready and integrates seamlessly with the existing Enabel UX ecosystem.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add a Widget component</issue_title>
<issue_description>Description:
Implement a reusable Twig component, visually and structurally, aligned with the Enabel Bootstrap Theme Widget.
The component must use Symfony UX Icons for any iconography.

References:

Tasks:

  • Analyze Widget.astro and extract HTML/CSS structure, classes, theming (colors, spacing, typography).
  • Create a new Twig component in the bundle.
  • Ensure style compatibility with Enabel Bootstrap Theme (no inline styles, only utility classes or theme CSS).
  • Integrate Symfony UX Icons for callout types or indicators.
  • Implement configurable props:
    • label (text)
    • variant (primary, secondary, info, etc.)
    • icon (rendered with Symfony UX Icons)
    • link (link, url)
  • Add examples and documentation in the bundle demo page.
  • Test for responsiveness and accessibility.

Acceptance Criteria:

  • The Twig component visually matches the Enabel callout design.
  • Icons are rendered using UX Icons
  • The component is fully configurable via Twig variables.
{{ component('Enabel:Ux:Widget', {
    label: 'Project',
    variant: 'primary',
    icon: 'eos-icons:project',
    link: '/project'
}) }}
  • No inline CSS or JavaScript — only Enabel Theme classes are used.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #9


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI self-assigned this Oct 16, 2025
Copilot AI and others added 2 commits October 16, 2025 07:32
…nsive demo

Co-authored-by: damienlagae <2233003+damienlagae@users.noreply.github.com>
Co-authored-by: damienlagae <2233003+damienlagae@users.noreply.github.com>
Copilot AI changed the title [WIP] Add reusable Widget component with Symfony UX Icons Add Widget component with Enabel Bootstrap Theme integration Oct 16, 2025
Copilot AI requested a review from damienlagae October 16, 2025 07:39
@damienlagae
Copy link
Member

@copilot il manque la partie documentation

Co-authored-by: damienlagae <2233003+damienlagae@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

@copilot il manque la partie documentation

Documentation complète ajoutée ! J'ai créé une documentation comprehensive pour le composant Widget dans docs/Widget/widget.md avec tous les exemples d'usage, paramètres, et bonnes pratiques. Le fichier docs/index.md a également été mis à jour pour inclure le nouveau composant. Commit: 8fb71e4

Copilot AI changed the title Add Widget component with Enabel Bootstrap Theme integration Add Widget component with Enabel Bootstrap Theme integration and comprehensive documentation Oct 16, 2025
@damienlagae damienlagae marked this pull request as ready for review October 16, 2025 09:52
@damienlagae damienlagae merged commit 7dcb57c into main Oct 16, 2025
14 checks passed
@damienlagae damienlagae deleted the copilot/add-widget-component branch October 16, 2025 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Widget component

2 participants