From 9c498c6810584b230e1ba7c666fd8af751b55a8c Mon Sep 17 00:00:00 2001 From: Uchechukwu Obasi Date: Wed, 12 May 2021 14:39:28 +0100 Subject: [PATCH] Spinner: updates story from knobs to control (#33988) --- .../src/components/Spinner/Spinner.story.tsx | 49 +++++++++++++------ .../src/components/Spinner/Spinner.tsx | 2 +- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx b/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx index 3dbb826c44b..751fe5a8f08 100644 --- a/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx +++ b/packages/grafana-ui/src/components/Spinner/Spinner.story.tsx @@ -1,7 +1,8 @@ import React from 'react'; -import { number, color } from '@storybook/addon-knobs'; +import { Meta, Story } from '@storybook/react'; import { withCenteredStory } from '../../utils/storybook/withCenteredStory'; import { Spinner } from '@grafana/ui'; +import { Props } from './Spinner'; import mdx from './Spinner.mdx'; export default { @@ -12,27 +13,45 @@ export default { docs: { page: mdx, }, + controls: { + exclude: ['className', 'iconClassName', 'style', 'inline'], + }, + knobs: { + disable: true, + }, }, -}; + argTypes: { + backgroundColor: { control: { type: 'color' } }, + color: { control: { type: 'color' } }, + }, +} as Meta; -export const basic = () => { - return ( -
- -
- ); -}; +interface StoryProps extends Partial { + backgroundColor: string; + color: string; + withStyle: boolean; +} -export const withStyle = () => { +export const Basic: Story = (args) => { return (
); }; +Basic.args = { + backgroundColor: 'white', + color: 'red', + size: 34, + withStyle: false, +}; diff --git a/packages/grafana-ui/src/components/Spinner/Spinner.tsx b/packages/grafana-ui/src/components/Spinner/Spinner.tsx index b233463fd29..1ccf2c8748f 100644 --- a/packages/grafana-ui/src/components/Spinner/Spinner.tsx +++ b/packages/grafana-ui/src/components/Spinner/Spinner.tsx @@ -16,7 +16,7 @@ const getStyles = stylesFactory((size: number, inline: boolean) => { }; }); -type Props = { +export type Props = { className?: string; style?: React.CSSProperties; iconClassName?: string;