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

Target Multiple Variant Options within Compound Variants #76

Merged
merged 5 commits into from
Dec 5, 2022

Conversation

joe-bell
Copy link
Owner

@joe-bell joe-bell commented Dec 5, 2022

Description

Follows up on @JeroenReumkens' wonderful work in #66

This PR introduces the ability to target multiple variants at once within compoundVariants (whilst preserving type-safety)

const button = cva("button", {
  variants: {
    intent: {
      primary: "button--primary",
      secondary: "button--secondary",
      warning: "button--warning",
    },
    disabled: {
      true: "button--disabled",
      false: "button--enabled",
    },
  },
  compoundVariants: [
    {
      // ✨ apply to `secondary` and `warning` intents ✨
      intent: ["secondary", "warning"],
      disabled: true,
      class: "text-black",
    },
  ],
});

Tasks

Additional context

#66


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Follow the Style Guide.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

@joe-bell joe-bell marked this pull request as ready for review December 5, 2022 07:46
@joe-bell joe-bell changed the title Target Multiple Variants within Compound Variants Target Multiple Variant Options within Compound Variants Dec 5, 2022
@joe-bell joe-bell merged commit 8d5e2c5 into main Dec 5, 2022
@joe-bell joe-bell deleted the feat/cv-multi branch December 5, 2022 07:50
@JeroenReumkens
Copy link
Contributor

Thanks for pushing this over the finish line @joe-bell 🥰
Last week I tweaked my Github notifications, and that seemed to not send any to my email anymore. So I just missed everything 😬 Wonderful work though, glad to see this made it in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants