diff --git a/packages/grafana-ui/src/components/Button/Button.story.tsx b/packages/grafana-ui/src/components/Button/Button.story.tsx index 16612418b99b7..c73414e90a583 100644 --- a/packages/grafana-ui/src/components/Button/Button.story.tsx +++ b/packages/grafana-ui/src/components/Button/Button.story.tsx @@ -20,17 +20,13 @@ export default { docs: { page: mdx, }, + knobs: { + disabled: true, + }, }, }; -export const Simple: Story = ({ disabled, icon, children, size, variant }) => { - return ( - - ); -}; - +export const Simple: Story = ({ children, ...args }) => ; Simple.args = { variant: 'primary', size: 'md', diff --git a/packages/grafana-ui/src/components/Forms/Field.story.tsx b/packages/grafana-ui/src/components/Forms/Field.story.tsx index 8fc8bdaf6727b..2a69c39ffd41e 100644 --- a/packages/grafana-ui/src/components/Forms/Field.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Field.story.tsx @@ -1,62 +1,62 @@ import React, { useState, useCallback } from 'react'; -import { boolean, number, text } from '@storybook/addon-knobs'; -import { Field, Input, Switch } from '@grafana/ui'; +import { Story } from '@storybook/react'; +import { Field, FieldProps } from './Field'; +import { Input, Switch } from '..'; import mdx from './Field.mdx'; export default { title: 'Forms/Field', component: Field, + argTypes: { + children: { control: { disable: true } }, + className: { control: { disable: true } }, + }, parameters: { docs: { page: mdx, }, + knobs: { + disabled: true, + }, }, }; -const getKnobs = () => { - const CONTAINER_GROUP = 'Container options'; - // --- - const containerWidth = number( - 'Container width', - 300, - { - range: true, - min: 100, - max: 500, - step: 10, - }, - CONTAINER_GROUP - ); +export const Simple: Story = args => ( +
+ + + +
+); - const BEHAVIOUR_GROUP = 'Behaviour props'; - const disabled = boolean('Disabled', false, BEHAVIOUR_GROUP); - const invalid = boolean('Invalid', false, BEHAVIOUR_GROUP); - const loading = boolean('Loading', false, BEHAVIOUR_GROUP); - const error = text('Error message', '', BEHAVIOUR_GROUP); - - return { containerWidth, disabled, invalid, loading, error }; +Simple.args = { + label: 'Graphite API key', + description: 'Your Graphite instance API key', + disabled: false, + invalid: false, + loading: false, + error: 'Not valid input', + horizontal: false, }; -export const Simple = () => { - const { containerWidth, ...otherProps } = getKnobs(); - return ( -
- - - -
- ); -}; - -export const HorizontalLayout = () => { +export const HorizontalLayout: Story = args => { const [checked, setChecked] = useState(false); const onChange = useCallback(e => setChecked(e.currentTarget.checked), [setChecked]); - const { containerWidth, ...otherProps } = getKnobs(); return ( -
- +
+
); }; + +HorizontalLayout.args = { + label: 'Show labels', + description: 'Display threshold labels', + disabled: false, + invalid: false, + loading: false, + error: 'Not valid input', + horizontal: true, +};