Skip to content

Chore: More reusable Blade components#247

Open
McNamara84 wants to merge 11 commits intomainfrom
chore/more-components-for-dry
Open

Chore: More reusable Blade components#247
McNamara84 wants to merge 11 commits intomainfrom
chore/more-components-for-dry

Conversation

@McNamara84
Copy link
Copy Markdown
Owner

@McNamara84 McNamara84 commented Dec 19, 2025

This pull request introduces a set of reusable Blade components for form elements and card sections, and refactors the artifact and device show views to use these new components. The goal is to standardize the UI, improve code maintainability, and reduce duplication.

Changes & Rationale

Introduction of reusable components:

  • Form components:

    • Added new Blade components and corresponding PHP classes for form elements: Input, Select, and Textarea, each supporting common attributes, validation, and hint display. [1] [2] [3] [4] [5] [6]
    • Added a form/alerts component to display validation errors, session messages, and an optional required fields hint.
  • Card and data display components:

    • Introduced a card/section component for consistent card-based section layouts, supporting titles, badges, and flexible content.
    • Added a card/data-row component for rendering definition list rows with labels and values, including fallback values and slot support.
    • Added a card/form component for wrapping forms in a styled card layout.

Refactoring of artifact and device show views

  • Refactored artifacts/show.blade.php and devices/show.blade.php to use the new x-card.section and x-card.data-row components, replacing manual card markup and definition lists for a more modular and readable structure. [1] [2] [3] [4] [5] [6]

Related Issues

Definition of Done Checklist

  • User story requirements met
  • Documentation updated
  • New code covered by unit tests
  • All unit tests pass locally
  • Manually tested
  • Works on desktop devices
  • Works on mobile devices

Laravel-Specific Changes

  • Migrations
  • Models
  • Views
  • Routes
  • Seeders
  • Config
  • Artisan commands

Infrastructure & Tooling Changes

  • PHP dependencies
  • Node.js dependencies
  • Tooling/scripts
  • CI/CD workflows
  • Repository meta/templates

Additional Notes

Moved validation and session alert markup into a new Blade component (x-form.alerts) for reuse. Updated inputform_person.blade.php to use the new component, reducing code duplication and improving maintainability.
@McNamara84 McNamara84 self-assigned this Dec 19, 2025
@McNamara84 McNamara84 added the enhancement New feature or request label Dec 19, 2025
Replaced inline error and success message handling in input forms with the reusable <x-form.alerts /> Blade component for consistency and maintainability across artifact, device, image, institution, location, material, project, and venue forms.
Introduces a Laravel Blade component and its PHP class for rendering form input fields with support for labels, validation, hints, and various input attributes. This improves code reuse and consistency across forms.
Introduces a new Select component for forms, including a PHP class and Blade view. The component supports dynamic options, custom labels, placeholders, validation, and error display for consistent select input rendering.
Introduces a new Textarea Blade component and its PHP class for form inputs. Supports label, value, hint, placeholder, required flag, and row count, improving form consistency and reusability.
Replaced manual input and select fields in material, person, and venue input forms with reusable <x-form.input> and <x-form.select> components. This improves code consistency, maintainability, and leverages shared form logic.
Replaced manual form markup in artifact, image, institution, and project input forms with reusable Blade form components for inputs, selects, and textareas. This improves code maintainability, consistency, and readability across the application's forms.
Introduces a reusable Blade component for card sections with optional title, count badge, and slot content. The component supports custom IDs and accessibility via aria-labelledby.
Introduced a new Blade component 'card.form' for reusable card-styled forms. Refactored the person input form to use this new component, simplifying the markup and improving consistency.
Introduces a reusable Blade component for displaying labeled data rows within card layouts. The component supports custom labels, values, fallback text, and configurable CSS classes for flexible layout.
Replaces manual card and data row markup in show views for artifacts, devices, institutions, locations, materials, and projects with reusable x-card.section and x-card.data-row Blade components. This improves code consistency, readability, and maintainability across resource detail pages.
@McNamara84 McNamara84 marked this pull request as ready for review December 23, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant