Skip to content

Commit

Permalink
Update storybook to allow picking the layout
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Aug 7, 2024
1 parent 8b16964 commit 769dc91
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/dataviews/src/components/dataform/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import DataForm from '../index';
const meta = {
title: 'DataViews/DataForm',
component: DataForm,
argTypes: {
type: {
control: { type: 'select' },
description:
'Chooses the layout of the form. "regular" is the default layout.',
options: [ 'regular', 'panel' ],
},
},
};
export default meta;

Expand Down Expand Up @@ -45,7 +53,7 @@ const fields = [
},
];

export const Default = () => {
export const Default = ( { type }: { type: 'panel' | 'regular' } ) => {
const [ post, setPost ] = useState( {
title: 'Hello, World!',
order: 2,
Expand All @@ -61,7 +69,10 @@ export const Default = () => {
<DataForm
data={ post }
fields={ fields }
form={ form }
form={ {
...form,
type,
} }
onChange={ setPost }
/>
);
Expand Down

0 comments on commit 769dc91

Please sign in to comment.