reaviz / reablocks

🧩 Component Library for React based on Tailwind. Maintained by @goodcodeus.
https://reablocks.dev
Apache License 2.0
131 stars 10 forks source link

Extend size and variant prop types #213

Closed ghsteff closed 5 months ago

ghsteff commented 5 months ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[x] Other... Please describe: improvement

What is the current behavior?

You can't easily add extra sizes or variants to components

What is the new behavior?

You can add custom sizes or variants to multiple component themes

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

e.g. custom destructive button variant

<Button
  theme={extendComponentTheme<ButtonTheme>(buttonTheme, {
    variants: {
      destructive: 'bg-red-500 hover:bg-red-600 border-red-500 text-white'
    }
  })}
  variant="destructive"
>
  Destructive
</Button>
image

e.g. custom XL radio button size

<Radio
  theme={extendComponentTheme<RadioTheme>(radioTheme, {
    sizes: {
      xl: 'h-8 w-8'
    },
    indicator: {
      sizes: {
        xl: 'w-6 h-6'
      }
    }
  })}
  size="xl"
  label="XL"
/>
image
netlify[bot] commented 5 months ago

Deploy Preview for reablocks-storybook ready!

Name Link
Latest commit 9f07966e368d38ed5f62c013931d5d5ee360936a
Latest deploy log https://app.netlify.com/sites/reablocks-storybook/deploys/664fa2a23279430008abac1d
Deploy Preview https://deploy-preview-213--reablocks-storybook.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.