Skip to content

Commit

Permalink
fix: [improvement/button] add theme prop for button
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgoud committed Aug 17, 2023
1 parent 6fc77d6 commit aff081a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/components/button/src/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const buttonProps = buildProps({
theme: {
type: String as PropType<PuikButtonTheme>,
required: false,
default: 'light',
},
variant: {
type: String as PropType<PuikButtonVariant>,
Expand Down
24 changes: 21 additions & 3 deletions packages/components/button/stories/button.stories.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
import { capitalize } from 'lodash-unified'
import PuikButton from './../src/button.vue'
import { buttonVariants, buttonSizes } from './../src/button'
import { buttonVariants, buttonSizes, buttonTheme } from './../src/button'
import type { StoryObj, Meta, StoryFn, Args } from '@storybook/vue3'

const buttonVariantsSummary = buttonVariants.join('|')
const buttonSizesSummary = buttonSizes.join('|')
const buttonThemeSummary = buttonTheme.join('|')

export default {
title: 'Components/Button',
component: PuikButton,
argTypes: {
theme: {
control: 'select',
description: 'Set the button color theme',
options: buttonTheme,
table: {
defaultValue: {
summary: 'light',
},
type: {
summary: buttonThemeSummary,
},
},
},
variant: {
control: 'select',
description: 'Set the button variant',
Expand Down Expand Up @@ -73,6 +87,7 @@ export default {
},
},
args: {
theme: 'light',
variant: 'primary',
size: 'md',
fluid: false,
Expand Down Expand Up @@ -105,22 +120,25 @@ export const Default = {
code: `
<!--VueJS Snippet -->
<!--
$themes: ${buttonThemeSummary}
$sizes: ${buttonSizesSummary}
$variants: ${buttonVariantsSummary}
-->
<puik-button
:theme="$themes"
:size="$sizes"
:variant="$variants"
:fluid="true|false"
:disabled="true|false"
:left-icon="leftIcon"
:right-icon="rightIcon"
>
>
My button
</puik-button>
<!--HTML/CSS Snippet-->
<!--
$themes: ${buttonThemeSummary} (defaults to light)
$sizes: ${buttonSizesSummary} (defaults to md)
$variants: ${buttonVariantsSummary}
-->
Expand Down

0 comments on commit aff081a

Please sign in to comment.