Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors two Blade components to make their CSS class props optional by moving default values into inline fallbacks.
- Changed
imageContainerClassAttributesandclassAttributesprop defaults tonull - Added inline
??fallbacks for default Tailwind CSS classes in the templates
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| resources/views/components/list-image-card.blade.php | Made image container classes optional with a null coalesce fallback |
| resources/views/components/list-grid.blade.php | Made grid wrapper classes optional with a null coalesce fallback |
Comments suppressed due to low confidence (2)
resources/views/components/list-image-card.blade.php:10
- Add component tests to verify both custom and default class scenarios for
imageContainerClassAttributes, ensuring the fallback behaves as expected.
<div class="{{ $imageContainerClassAttributes ?? 'h-32 h-32 flex-shrink-0 overflow-hidden' }}">
resources/views/components/list-grid.blade.php:3
- Include tests to cover cases where
classAttributesis provided and when it falls back to the default, ensuring both render paths are validated.
<div class="{{ $classAttributes ?? 'mt-2 grid grid-cols-1 lg:grid-cols-2 gap-4'}}">
Comment on lines
+3
to
+10
| 'imageContainerClassAttributes' => null, | ||
| 'name', | ||
| 'role' => null, | ||
| 'icons' => [], | ||
| ]) | ||
|
|
||
| <div class="flex flex-row rounded-xl overflow-hidden transition group"> | ||
| <div class="{{ $imageContainerClassAttributes }}"> | ||
| <img src="{{ $image }}" alt="{{ $name }}" | ||
| class="w-full h-full object-cover transition-transform duration-300 ease-in-out group-hover:scale-105"/> | ||
| <div class="{{ $imageContainerClassAttributes ?? 'h-32 h-32 flex-shrink-0 overflow-hidden' }}"> |
There was a problem hiding this comment.
Consider defining the default container classes directly in the @props declaration (e.g., 'imageContainerClassAttributes' => 'h-32 h-32 flex-shrink-0 overflow-hidden') and removing the inline fallback to simplify the template logic.
Comment on lines
+1
to
+3
| @props(['classAttributes' => null]) | ||
|
|
||
| <div class="{{ $classAttributes }}"> | ||
| <div class="{{ $classAttributes ?? 'mt-2 grid grid-cols-1 lg:grid-cols-2 gap-4'}}"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.