-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STP-84: a few little changes to the storybook docs.
- Loading branch information
Showing
1 changed file
with
6 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,23 @@ | ||
import React from 'react' | ||
|
||
import FormGroup, { FormGroupProps } from './index.js' | ||
import { action } from '@storybook/addon-actions' | ||
import FormGroup from './index.js' | ||
import InputText from '../Input/index.js' | ||
|
||
export default { | ||
title: 'Components/FormGroup', | ||
component: FormGroup, | ||
argTypes: { | ||
onSubmit: {}, | ||
}, | ||
onSubmit: { action: 'clicked' } | ||
} | ||
} | ||
|
||
const DefaultStoryTemplate = (args: FormGroupProps) => ( | ||
<FormGroup onSubmit={args.onSubmit}> | ||
const DefaultStoryTemplate = () => ( | ||
<FormGroup onSubmit={action('submit')}> | ||
<InputText type="text" name="test-a" /> | ||
<br /> | ||
<button type="submit">submit</button> | ||
</FormGroup> | ||
) | ||
|
||
export const Default = DefaultStoryTemplate.bind({}) | ||
|
||
Default.args = { | ||
onSubmit: (e) => { | ||
e.preventDefault() | ||
window.alert(`submitted: ${e.target}`) | ||
}, | ||
} |