mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Another storybook csf conversion (#24097)
* Convert Spinner to CSF * Convert TableInputCSV to CSF * Convert ToggleButtonGroup to CSF * Convert ValueMappingsEditor to CSF * Convert useDelayedSwitch to CSF
This commit is contained in:
parent
9939d3bb38
commit
ab60a8d37a
@ -1,15 +1,18 @@
|
||||
import React from 'react';
|
||||
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
||||
import { Spinner } from './Spinner';
|
||||
|
||||
const story = storiesOf('Visualizations/Spinner', module);
|
||||
story.addDecorator(withCenteredStory);
|
||||
story.add('spinner', () => {
|
||||
export default {
|
||||
title: 'Visualizations/Spinner',
|
||||
component: Spinner,
|
||||
decorators: [withCenteredStory],
|
||||
};
|
||||
|
||||
export const basic = () => {
|
||||
return (
|
||||
<div>
|
||||
<Spinner />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@ -1,16 +1,17 @@
|
||||
import React from 'react';
|
||||
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import TableInputCSV from './TableInputCSV';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { DataFrame } from '@grafana/data';
|
||||
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
||||
|
||||
const TableInputStories = storiesOf('Forms/TableInputCSV', module);
|
||||
export default {
|
||||
title: 'Forms/TableInputCSV',
|
||||
component: TableInputCSV,
|
||||
decorators: [withCenteredStory],
|
||||
};
|
||||
|
||||
TableInputStories.addDecorator(withCenteredStory);
|
||||
|
||||
TableInputStories.add('default', () => {
|
||||
export const basic = () => {
|
||||
return (
|
||||
<TableInputCSV
|
||||
width={400}
|
||||
@ -22,4 +23,4 @@ TableInputStories.add('default', () => {
|
||||
}}
|
||||
/>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@ -1,12 +1,15 @@
|
||||
import React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
|
||||
import { ToggleButton, ToggleButtonGroup } from './ToggleButtonGroup';
|
||||
import { UseState } from '../../utils/storybook/UseState';
|
||||
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
||||
|
||||
const ToggleButtonGroupStories = storiesOf('Forms/Legacy/ToggleButtonGroup', module);
|
||||
export default {
|
||||
title: 'Forms/Legacy/ToggleButtonGroup',
|
||||
component: ToggleButtonGroup,
|
||||
decorators: [withCenteredStory],
|
||||
};
|
||||
|
||||
const options = [
|
||||
{ value: 'first', label: 'First' },
|
||||
@ -14,9 +17,7 @@ const options = [
|
||||
{ value: 'third', label: 'Third' },
|
||||
];
|
||||
|
||||
ToggleButtonGroupStories.addDecorator(withCenteredStory);
|
||||
|
||||
ToggleButtonGroupStories.add('default', () => {
|
||||
export const basic = () => {
|
||||
return (
|
||||
<UseState
|
||||
initialState={{
|
||||
@ -46,4 +47,4 @@ ToggleButtonGroupStories.add('default', () => {
|
||||
}}
|
||||
</UseState>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
@ -1,10 +1,12 @@
|
||||
import React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { ValueMappingsEditor } from './ValueMappingsEditor';
|
||||
|
||||
const ValueMappingsEditorStories = storiesOf('Pickers and Editors/ValueMappingsEditor', module);
|
||||
export default {
|
||||
title: 'Pickers and Editors/ValueMappingsEditor',
|
||||
component: ValueMappingsEditor,
|
||||
};
|
||||
|
||||
ValueMappingsEditorStories.add('default', () => {
|
||||
export const basic = () => {
|
||||
return <ValueMappingsEditor valueMappings={[]} onChange={action('Mapping changed')} />;
|
||||
});
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { withCenteredStory } from './storybook/withCenteredStory';
|
||||
import { useDelayedSwitch } from './useDelayedSwitch';
|
||||
import { boolean, number } from '@storybook/addon-knobs';
|
||||
@ -19,8 +18,11 @@ function StoryWrapper() {
|
||||
return <div>{valueDelayed ? 'ON' : 'OFF'}</div>;
|
||||
}
|
||||
|
||||
const story = storiesOf('useDelayedSwitch', module);
|
||||
story.addDecorator(withCenteredStory);
|
||||
story.add('useDelayedSwitch', () => {
|
||||
export default {
|
||||
title: 'useDelayedSwitch',
|
||||
decorators: [withCenteredStory],
|
||||
};
|
||||
|
||||
export const basic = () => {
|
||||
return <StoryWrapper />;
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user