Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive Variants Ordering Incorrectly #182

Open
rabah opened this issue Apr 12, 2024 · 3 comments
Open

Responsive Variants Ordering Incorrectly #182

rabah opened this issue Apr 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@rabah
Copy link

rabah commented Apr 12, 2024

Describe the bug
When using responsive variants to style components in either React or Vue (I just tested with both), the classes do not seem to order correctly. It seems like the initial value is always in front of the other values in the class list order which means the correct styles are not applied at the correct break points.

To Reproduce
Steps to reproduce the behavior:
I created a reproduction on stackblitz for both Nuxt & Next.
Nuxt: Stackblitz Link
Next: Stackblitz Link

if you see the object styling provided by tailwind-variants it should conditionally display the rounded styles only initial, but then at a higher breakpoint, it should not display the rounded styles. I have correctly wrapped the tailwind config with the withTV function.

Expected behavior
I should correctly display the relevant styles at each breakpoint.

Screenshots
Nuxt Button with Incorrect class ordering
CleanShot 2024-04-13 at 12  36 14@2x

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Arc
  • Version 1.38

Additional context
I may be doing something wrong but after copying the instructions from the site with no success, im stuck 😄

@rabah rabah added the bug Something isn't working label Apr 12, 2024
@mskelton
Copy link
Collaborator

The class order doesn't matter here since Tailwind adds media queries after non-media queries in the generated stylesheet.

My guess is this issue is more than likely an issue with the transformer not working in Vue.

Side note: The Next.js reproduction is broken in a couple ways

@rabah
Copy link
Author

rabah commented Apr 23, 2024

The class order doesn't matter here since Tailwind adds media queries after non-media queries in the generated stylesheet.

My guess is this issue is more than likely an issue with the transformer not working in Vue.

Side note: The Next.js reproduction is broken in a couple ways

Thanks for that. That makes sense. 👍🏼

@blowsie
Copy link

blowsie commented Jun 4, 2024

const variants = buttonVariants({
  size: props.size,
  rounded: props.rounded,
  class: props.class,
});

Is not reactive, if you pass these into the template it will work, which raises a good question, what's the best way to make this reactive in the script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants