infinum / eightshift-frontend-libs-tailwind

MIT License
1 stars 0 forks source link

[BUG] - combinations don't work properly with an array of attributes #53

Closed iobrado closed 1 month ago

iobrado commented 1 month ago

After updating my project to FE Libs Tailwind 1.4.1, I noticed the Tailwind classes from combinations aren't applied if passing an array of attributes.

This snippet doesn't apply the listed classes.

"combinations": [
            {
                "attributes": {
                    "buttonVariant": [
                        "primary",
                        "secondary"
                    ]
                },
                "twClasses": "border [&>svg]:size-5 gap-2 py-2 rounded-full"
            },
]

But replacing the buttonVariant attribute value with a string instead of an array, e.g. "buttonVariant": "primary", solves the issue and the classes are applied.

kancijan commented 1 month ago

It's because you should compare at least two attributes. buttonVariant is solo here. In this case, I usually use "buttonUse": true to make it valid.

goranalkovic-infinum commented 1 month ago

@kancijan it's probably something else, the logic for checking whether it matches was rewritten.