Skip to content

fix: icon size & support BackedEnum#38

Open
agencetwogether wants to merge 1 commit into199ocero:4.xfrom
agencetwogether:fix/icon
Open

fix: icon size & support BackedEnum#38
agencetwogether wants to merge 1 commit into199ocero:4.xfrom
agencetwogether:fix/icon

Conversation

@agencetwogether
Copy link
Contributor

Because the Filament icon component generates the classes fi-icon and fi-size-{$size->value}, it's no longer necessary to use the $iconSizeClass variable in radio-deck.blade.php

Instead, you can directly pass the desired size to size attribute of the component.

<x-filament::icon :icon="$icon" :size="$iconSizeValue" @class([
    'flex-shrink-0',
    match ($color) {
        'gray' => 'fi-color-gray text-gray-600 dark:text-gray-500',
        default => 'fi-color-custom text-custom-600 dark:text-custom-500',
    },
]) @style([
    \Filament\Support\get_color_css_variables($color, shades: [600, 500]) => $color !== 'gray',
]) />

Indeed, without this fix, if the size 2xl was defined, the component's generated class remained fi-size-md and not fi-size-2xl. And so the icon wasn't the right size.

And with the Filament CSS icon class definitions, the sizes are correctly defined.

See filament/packages/support/resources/css/components/icon.cssfile.

Furthermore, this pull request allows the use of icons with backed enums.

The readme file has been updated accordingly.
Thanks

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.

1 participant