Added “data-variant” attribute to components #407
+218
−9
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.
Hello everyone!!!
I posted this PR that adds the
data-variant
attribute to Flux (free) components.This PR solves the [#393] discussion that I had started a couple of days ago..
The problem
I found myself in a situation where I had to apply a style to buttons (selectable via the
data-flux-button
attribute), but this style was being applied globally without distinction of the button variant.So the idea was to add, where possible, a
data-variant
attribute that could come in handy in case you want to apply a certain style only to certain variants and not to all of them.Video example
data-variant.example.mov
Code
<flux:button variant="primary" class="teal">Primary</flux:button>
<flux:button variant="outline" class="teal">Outline</flux:button>
[data-flux-button][data-variant="primary"].teal { @apply !bg-teal-500 !text-white hover:!bg-teal-400; }
[data-flux-button][data-variant="outline"].teal { @apply !bg-transparent !border-teal-500 !text-teal-500 hover:!border-teal-400; }
I'm excited to hear your thoughts!! What do you think? Can it be useful?
Thank you so much for the incredible work you do!!!
Regards,
Fabio