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

Add presets #24

Open
sergeysova opened this issue Jun 30, 2022 · 0 comments
Open

Add presets #24

sergeysova opened this issue Jun 30, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@sergeysova
Copy link
Member

export const Button = component('button', baseStyles, {
  variants: {
    color: {
      gray: css`
        background-color: gainsboro;
      `,
      blue: css`
        background-color: dodgerblue;
      `,
    },
    size: {
      md: css`
        height: 26px;
      `,
      lg: css`
        height: 36px;
      `,
    },
  },
  compound: [
    {
      color: 'blue',
      size: 'lg',
      css: css`
        background-color: purple;
      `,
    },
  ],
  defaults: {
    color: 'gray',
    size: 'md',
  },
  presets: {
    primary: {
      color: "blue",
      css: css` @apply p-4;`
    },
  },
});
  1. Preset applies via preset prop.
  2. Preset can apply just css or just variants
  3. Variants passed as props applied over preset
  4. Compound applied after all variants is calculated
@sergeysova sergeysova added the enhancement New feature or request label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant