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

Basic API #1

Closed
6 tasks done
kinday opened this issue Dec 15, 2021 · 1 comment
Closed
6 tasks done

Basic API #1

kinday opened this issue Dec 15, 2021 · 1 comment

Comments

@kinday
Copy link
Owner

kinday commented Dec 15, 2021

Reimplement basic classnames API as macro:

  • Accept infinite arguments
    classNames("a", "b", "c" /* etc. */)
    // => "a b c"
  • Accept objects
    classNames({ a: true, b: props.foo })
    // => (true ? "a" : "") + (props.foo ? " b" : "")
  • Accept arrays
    classNames(["a", "b"], ["c", "d"])
    // => "a b c d"
  • Accept logical expressions
    classNames(props.foo && "foo", props.bar || "bar")
    // => (props.foo ? "foo" : "") + (props.bar ? "" : " bar")
  • Accept variables
    classNames(["a", props.className])
    // => "a" + (" " + props.className)
  • Accept combinations of above nested arbitrarily
    classNames(props.foo && ["foo", "fighters"], "bar", ["qux", { baz: props.baz }])
    // => "bar qux" + (props.foo ? " foo fighters" : "") + (props.baz ? " baz" : "")
kinday added a commit that referenced this issue Dec 15, 2021
kinday added a commit that referenced this issue Dec 15, 2021
@kinday kinday mentioned this issue Dec 15, 2021
@kinday kinday closed this as completed in d4c6233 Dec 15, 2021
@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kinday kinday added this to the Stable Release milestone Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant