lukeed / clsx

A tiny (239B) utility for constructing `className` strings conditionally.
MIT License
8.08k stars 141 forks source link

Proposed ability to add sub & pseudo classes #93

Closed SirCameron closed 5 months ago

SirCameron commented 5 months ago

Instead of writing: hover:foo hover:bar hover:baz hover:after:foo hover:after:baz

This proposes: clsx({ hover: ["foo", "bar", "baz", { after: ["foo", "baz"] }] });

Please excuse the reformatting of code :)

lukeed commented 5 months ago

Closing this PR for the reason mentioned above. You may open an issue to propose a clsx/nested (🤷 name tbd) submodule and invite discussion. I think this could be useful to some, but it definitely can't be added as the default behavior.

Thank you for the work & suggestion!

SirCameron commented 5 months ago

Thanks for checking it out :) I'll put it in a submodule and create a new PR.