From e104b7a54e8c35d398cf68c1a9003a26c828107a Mon Sep 17 00:00:00 2001 From: Driss Chelouati Date: Mon, 4 Dec 2023 22:24:11 +0100 Subject: [PATCH] feat(Button): rename shape to rounded and flavor to variant --- .../components/button/button.component.ts | 8 +- src/plugins/components/button/button.docs.mdx | 12 +- .../components/button/button.stories.ts | 242 +++++++++--------- src/plugins/components/button/button.types.ts | 4 +- .../components/button/button.variants.ts | 16 +- 5 files changed, 141 insertions(+), 141 deletions(-) diff --git a/src/plugins/components/button/button.component.ts b/src/plugins/components/button/button.component.ts index a13f16b..47a66c6 100644 --- a/src/plugins/components/button/button.component.ts +++ b/src/plugins/components/button/button.component.ts @@ -11,9 +11,9 @@ export const Button = ({ label, loading, shadow, - shape, + rounded, children, - flavor = 'solid', + variant = 'solid', size = 'md', color = 'default', classes, @@ -25,10 +25,10 @@ export const Button = ({ class=${[ 'nui-button', variants.size[size], - variants.flavor[flavor], + variants.variant[variant], variants.color[color], loading && 'nui-button-loading', - shape && variants.shape[shape], + rounded && variants.rounded[rounded], shadow && variants.shadow[shadow], classes?.wrapper, ] diff --git a/src/plugins/components/button/button.docs.mdx b/src/plugins/components/button/button.docs.mdx index ae7db4a..5dc26fa 100644 --- a/src/plugins/components/button/button.docs.mdx +++ b/src/plugins/components/button/button.docs.mdx @@ -44,9 +44,9 @@ Size allows you to change the size of the button.
-### Flavor: solid +### Variants: solid -Flavors represent the visual styles applied to a button. Below are examples of the solid flavor. +Variantss represent the visual styles applied to a button. Below are examples of the solid flavor.
@@ -60,9 +60,9 @@ Flavors represent the visual styles applied to a button. Below are examples of t
-### Flavor: pastel +### Variants: pastel -Flavors represent the visual styles applied to a button. Below are examples of the pastel flavor. +Variantss represent the visual styles applied to a button. Below are examples of the pastel flavor.
@@ -74,9 +74,9 @@ Flavors represent the visual styles applied to a button. Below are examples of t
-### Flavor: outline +### Variants: outline -Flavors represent the visual styles applied to a button. Below are examples of the outline flavor. +Variantss represent the visual styles applied to a button. Below are examples of the outline flavor.
diff --git a/src/plugins/components/button/button.stories.ts b/src/plugins/components/button/button.stories.ts index 4fc024b..bb6040f 100644 --- a/src/plugins/components/button/button.stories.ts +++ b/src/plugins/components/button/button.stories.ts @@ -39,12 +39,12 @@ const meta = { options: ['sm', 'md', 'lg', 'xl'], defaultValue: 'md', }, - shape: { + rounded: { control: { type: 'select' }, options: ['straight', 'rounded', 'smooth', 'curved', 'full'], defaultValue: 'straight', }, - flavor: { + variant: { control: { type: 'select' }, options: ['solid', 'pastel', 'outline'], defaultValue: 'solid', @@ -69,9 +69,9 @@ export const Solid: Story = { color: 'default', label: 'Button', // set default values used for UI preview - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -79,36 +79,36 @@ export const Solid: Story = { // #region Shapes export const Straight: Story = { - name: 'Shape: straight', + name: 'Rounded: straight', args: { label: 'Button', }, } export const Rounded: Story = { - name: 'Shape: rounded', + name: 'Rounded: rounded', args: { - shape: 'rounded', + rounded: 'sm', label: 'Button', }, } export const Smooth: Story = { - name: 'Shape: smooth', + name: 'Rounded: smooth', args: { - shape: 'smooth', + rounded: 'md', label: 'Button', }, } export const Curved: Story = { - name: 'Shape: curved', + name: 'Rounded: curved', args: { - shape: 'curved', + rounded: 'lg', label: 'Button', }, } export const Full: Story = { - name: 'Shape: full', + name: 'Rounded: full', args: { - shape: 'full', + rounded: 'full', label: 'Button', }, } @@ -120,7 +120,7 @@ export const Sm: Story = { args: { size: 'sm', label: 'Button', - shape: 'rounded', + rounded: 'sm', }, } export const Md: Story = { @@ -128,7 +128,7 @@ export const Md: Story = { args: { size: 'md', label: 'Button', - shape: 'rounded', + rounded: 'sm', }, } export const Lg: Story = { @@ -136,7 +136,7 @@ export const Lg: Story = { args: { size: 'lg', label: 'Button', - shape: 'rounded', + rounded: 'sm', }, } // #endregion @@ -147,9 +147,9 @@ export const SolidDefault: Story = { args: { color: 'default', label: 'Button', - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -159,9 +159,9 @@ export const SolidMuted: Story = { args: { color: 'muted', label: 'Button', - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -171,9 +171,9 @@ export const SolidPrimary: Story = { args: { color: 'primary', label: 'Button', - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -183,9 +183,9 @@ export const SolidInfo: Story = { args: { color: 'info', label: 'Button', - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -195,9 +195,9 @@ export const SolidSuccess: Story = { args: { color: 'success', label: 'Button', - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -207,9 +207,9 @@ export const SolidWarning: Story = { args: { color: 'warning', label: 'Button', - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -219,9 +219,9 @@ export const SolidDanger: Story = { args: { color: 'danger', label: 'Button', - flavor: 'solid', + variant: 'solid', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -233,9 +233,9 @@ export const PastelPrimary: Story = { args: { color: 'primary', label: 'Button', - flavor: 'pastel', + variant: 'pastel', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -245,9 +245,9 @@ export const PastelInfo: Story = { args: { color: 'info', label: 'Button', - flavor: 'pastel', + variant: 'pastel', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -257,9 +257,9 @@ export const PastelSuccess: Story = { args: { color: 'success', label: 'Button', - flavor: 'pastel', + variant: 'pastel', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -269,9 +269,9 @@ export const PastelWarning: Story = { args: { color: 'warning', label: 'Button', - flavor: 'pastel', + variant: 'pastel', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -281,9 +281,9 @@ export const PastelDanger: Story = { args: { color: 'danger', label: 'Button', - flavor: 'pastel', + variant: 'pastel', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -295,9 +295,9 @@ export const OutlinePrimary: Story = { args: { color: 'primary', label: 'Button', - flavor: 'outline', + variant: 'outline', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -307,9 +307,9 @@ export const OutlineInfo: Story = { args: { color: 'info', label: 'Button', - flavor: 'outline', + variant: 'outline', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -319,9 +319,9 @@ export const OutlineSuccess: Story = { args: { color: 'success', label: 'Button', - flavor: 'outline', + variant: 'outline', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -331,9 +331,9 @@ export const OutlineWarning: Story = { args: { color: 'warning', label: 'Button', - flavor: 'outline', + variant: 'outline', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -343,9 +343,9 @@ export const OutlineDanger: Story = { args: { color: 'danger', label: 'Button', - flavor: 'outline', + variant: 'outline', loading: false, - shape: 'rounded', + rounded: 'sm', size: 'md', }, } @@ -357,8 +357,8 @@ export const IconDefault: Story = { args: { color: 'default', label: 'Button', - flavor: 'solid', - shape: 'rounded', + variant: 'solid', + rounded: 'sm', size: 'md', children: html` Button @@ -417,8 +417,8 @@ export const IconPrimary: Story = { args: { color: 'primary', label: 'Button', - flavor: 'solid', - shape: 'rounded', + variant: 'solid', + rounded: 'sm', size: 'md', children: html` Using the slot `, diff --git a/src/plugins/components/button/button.types.ts b/src/plugins/components/button/button.types.ts index 8992ce8..8ca70a9 100644 --- a/src/plugins/components/button/button.types.ts +++ b/src/plugins/components/button/button.types.ts @@ -4,8 +4,8 @@ export interface ButtonProps extends Record { label?: string loading?: boolean size?: 'sm' | 'md' | 'lg' | 'xl' - shape?: 'straight' | 'rounded' | 'smooth' | 'curved' | 'full' - flavor?: 'solid' | 'pastel' | 'outline' + rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full' + variant?: 'solid' | 'pastel' | 'outline' color?: | 'default' | 'light' diff --git a/src/plugins/components/button/button.variants.ts b/src/plugins/components/button/button.variants.ts index a0678ec..985fcaa 100644 --- a/src/plugins/components/button/button.variants.ts +++ b/src/plugins/components/button/button.variants.ts @@ -7,19 +7,19 @@ export const size = { xl: 'nui-button-big', } as const satisfies ButtonVariant<'size'> -export const shape = { - straight: '', - rounded: 'nui-button-rounded', - curved: 'nui-button-curved', - smooth: 'nui-button-smooth', +export const rounded = { + none: '', + sm: 'nui-button-rounded', + md: 'nui-button-curved', + lg: 'nui-button-smooth', full: 'nui-button-full', -} as const satisfies ButtonVariant<'shape'> +} as const satisfies ButtonVariant<'rounded'> -export const flavor = { +export const variant = { solid: 'nui-button-solid', pastel: 'nui-button-pastel', outline: 'nui-button-outline', -} as const satisfies ButtonVariant<'flavor'> +} as const satisfies ButtonVariant<'variant'> export const color = { none: '',