Skip to content

Commit

Permalink
feat(ButtonAction): rename shape prop to rounded, update stories
Browse files Browse the repository at this point in the history
  • Loading branch information
driss-chelouati committed Dec 5, 2023
1 parent cd9bf16 commit 06f085f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as variants from './button-action.variants'
export const ButtonAction = ({
label,
loading,
shape,
rounded,
children,
color = 'default',
classes,
Expand All @@ -23,7 +23,7 @@ export const ButtonAction = ({
'nui-button-action',
variants.color[color],
loading && 'nui-button-loading',
shape && variants.shape[shape],
rounded && variants.rounded[rounded],
classes?.wrapper,
]
.filter(Boolean)
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/components/button-action/button-action.doc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Buttons are an essential part of any application. Shuriken UI action buttons can

<br />

### Shape
### Rounded

Action button shapes allow you to change the border radiuses.

Expand Down
80 changes: 40 additions & 40 deletions src/plugins/components/button-action/button-action.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const meta = {
],
defaultValue: 'default',
},
shape: {
rounded: {
control: { type: 'select' },
options: ['straight', 'rounded', 'smooth', 'curved', 'full'],
options: ['none', 'sm', 'md', 'lg', 'full'],
defaultValue: 'straight',
},
onClick: { action: 'onClick' },
Expand All @@ -56,42 +56,42 @@ export const Solid: Story = {
label: 'Action',
// set default values used for UI preview
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}
// #endregion

// #region Shapes
// #region Rounded
export const Straight: Story = {
name: 'Shape: straight',
name: 'Rounded: none',
args: {
label: 'Button',
shape: 'straight',
rounded: 'none',
},
}
export const Rounded: Story = {
name: 'Shape: rounded',
name: 'Rounded: sm',
args: {
shape: 'rounded',
rounded: 'sm',
label: 'Button',
},
}
export const Smooth: Story = {
name: 'Shape: smooth',
name: 'Rounded: md',
args: {
shape: 'smooth',
rounded: 'md',
label: 'Button',
},
}
export const Curved: Story = {
name: 'Shape: curved',
name: 'Rounded: lg',
args: {
shape: 'curved',
rounded: 'lg',
label: 'Button',
},
}
export const Full: Story = {
name: 'Shape: full',
name: 'Rounded: full',
args: {
shape: 'full',
label: 'Button',
Expand All @@ -106,7 +106,7 @@ export const ColorDefault: Story = {
color: 'default',
label: 'Button',
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}

Expand All @@ -116,7 +116,7 @@ export const ColorMuted: Story = {
color: 'muted',
label: 'Button',
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}

Expand All @@ -126,7 +126,7 @@ export const ColorPrimary: Story = {
color: 'primary',
label: 'Button',
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}

Expand All @@ -136,7 +136,7 @@ export const ColorInfo: Story = {
color: 'info',
label: 'Button',
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}

Expand All @@ -146,7 +146,7 @@ export const ColorSuccess: Story = {
color: 'success',
label: 'Button',
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}

Expand All @@ -156,7 +156,7 @@ export const ColorWarning: Story = {
color: 'warning',
label: 'Button',
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}

Expand All @@ -166,48 +166,48 @@ export const ColorDanger: Story = {
color: 'danger',
label: 'Button',
loading: false,
shape: 'rounded',
rounded: 'sm',
},
}
// #endregion

// #region State: loading
export const StraightLoading: Story = {
name: 'Shape: straight',
name: 'Rounded: none',
args: {
label: 'Button',
shape: 'straight',
rounded: 'none',
loading: true,
},
}
export const RoundedLoading: Story = {
name: 'Shape: rounded',
name: 'Rounded: sm',
args: {
shape: 'rounded',
rounded: 'sm',
label: 'Button',
loading: true,
},
}
export const SmoothLoading: Story = {
name: 'Shape: smooth',
name: 'Rounded: md',
args: {
shape: 'smooth',
rounded: 'md',
label: 'Button',
loading: true,
},
}
export const CurvedLoading: Story = {
name: 'Shape: curved',
name: 'Rounded: lg',
args: {
shape: 'curved',
rounded: 'lg',
label: 'Button',
loading: true,
},
}
export const FullLoading: Story = {
name: 'Shape: full',
name: 'Rounded: full',
args: {
shape: 'full',
rounded: 'full',
label: 'Button',
loading: true,
},
Expand All @@ -216,39 +216,39 @@ export const FullLoading: Story = {

// #region State: disabled
export const StraightDisabled: Story = {
name: 'Shape: straight',
name: 'Rounded: none',
args: {
label: 'Button',
shape: 'straight',
rounded: 'none',
'?disabled': true,
},
}
export const RoundedDisabled: Story = {
name: 'Shape: rounded',
name: 'Rounded: sm',
args: {
shape: 'rounded',
rounded: 'sm',
label: 'Button',
'?disabled': true,
},
}
export const SmoothDisabled: Story = {
name: 'Shape: smooth',
name: 'Rounded: md',
args: {
shape: 'smooth',
rounded: 'md',
label: 'Button',
'?disabled': true,
},
}
export const CurvedDisabled: Story = {
name: 'Shape: curved',
name: 'Rounded: lg',
args: {
shape: 'curved',
rounded: 'lg',
label: 'Button',
'?disabled': true,
},
}
export const FullDisabled: Story = {
name: 'Shape: full',
name: 'Rounded:',
args: {
shape: 'full',
label: 'Button',
Expand All @@ -261,7 +261,7 @@ export const FullDisabled: Story = {
export const Slot: Story = {
name: 'Slots: default slot',
args: {
shape: 'rounded',
rounded: 'sm',
children: html`
<span>Using the slot</span>
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { PropertyVariant } from '~/types/utils'

export interface ButtonActionProps extends Record<string, unknown> {
label?: string
shape?: 'straight' | 'rounded' | 'smooth' | 'curved' | 'full'
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full'
loading?: boolean
color?:
| 'default'
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/components/button-action/button-action.variants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { ButtonActionVariant } from './button-action.types'

export const shape = {
straight: '',
rounded: 'nui-button-rounded',
smooth: 'nui-button-smooth',
curved: 'nui-button-curved',
export const rounded = {
none: '',
sm: 'nui-button-rounded',
md: 'nui-button-smooth',
lg: 'nui-button-curved',
full: 'nui-button-full',
} as const satisfies ButtonActionVariant<'shape'>
} as const satisfies ButtonActionVariant<'rounded'>

export const color = {
default: 'nui-button-default',
Expand Down

0 comments on commit 06f085f

Please sign in to comment.