Closed emi420 closed 4 days ago
Looks better!
But does this sort of approach replace the proposed Class Variance Authority setup?
Class Variance Authority is partially implemented, but I think we could use both things together, as one not replace the other.
Taking Header as an example:
const headerVariants = cva(
// Defaults to include in all variants
`
flex flex-row bg-[var(--hot-white)] items-center justify-between
sm:justify-around p-2 border-b-2 border-b-gray-100 border-b-solid
`,
{
variants: {
size: {
small: "h-8",
large: "h-14",
},
},
}
);
We could have a base class and then the variants:
const headerVariants = cva(
// Defaults to include in all variants
`hot-header-container`,
{
variants: {
size: {
small: "hot-h-8",
large: "hot-h-14",
},
},
}
);
Then, there are other places when styling doesn't have variance, like the example that I've provided. But, if we need variance there, we can also implement the same strategy, having a base class and the variants.
Looks great 🎉
Instead of adding classes to the element:
Use
@apply
(or--at-apply
)And then the single class: