From e95bab1f2b1a1b80a3d5fba460e078ba9a441038 Mon Sep 17 00:00:00 2001 From: Piotr Pomierski <70658299+Pomierski@users.noreply.github.com> Date: Wed, 31 Aug 2022 12:42:47 +0200 Subject: [PATCH] Storybook: Add controls to button story (#54389) --- .../src/components/Button/Button.story.tsx | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/packages/grafana-ui/src/components/Button/Button.story.tsx b/packages/grafana-ui/src/components/Button/Button.story.tsx index 04c171eb70d..e2c31137d6c 100644 --- a/packages/grafana-ui/src/components/Button/Button.story.tsx +++ b/packages/grafana-ui/src/components/Button/Button.story.tsx @@ -1,15 +1,17 @@ -import { ComponentStory, ComponentMeta } from '@storybook/react'; +import { ComponentStory } from '@storybook/react'; import React from 'react'; import { ComponentSize } from '../../types/size'; import { Card } from '../Card/Card'; import { HorizontalGroup, VerticalGroup } from '../Layout/Layout'; -import { allButtonVariants, allButtonFills, Button } from './Button'; +import { allButtonVariants, allButtonFills, Button, ButtonProps } from './Button'; import mdx from './Button.mdx'; import { ButtonGroup } from './ButtonGroup'; -const meta: ComponentMeta = { +const sizes: ComponentSize[] = ['lg', 'md', 'sm']; + +export default { title: 'Buttons/Button', component: Button, parameters: { @@ -17,10 +19,29 @@ const meta: ComponentMeta = { page: mdx, }, }, + argTypes: { + size: { + options: sizes, + }, + tooltip: { + table: { + disable: true, + }, + }, + tooltipPlacement: { + table: { + disable: true, + }, + }, + className: { + table: { + disable: true, + }, + }, + }, }; -export const Variants: ComponentStory = () => { - const sizes: ComponentSize[] = ['lg', 'md', 'sm']; +export const Examples: ComponentStory = () => { return ( {allButtonFills.map((buttonFill) => ( @@ -88,4 +109,12 @@ export const Variants: ComponentStory = () => { ); }; -export default meta; +export const Basic: ComponentStory = (args: ButtonProps) =>