Use Component Story Format for stories (#8108)
The recommended way of writing stories changed in Storybook v5.2 to the Component Story Format (CSF). Instead of using `storiesOf` and running everything upon module import, the new story format is a declarative description of each component that uses ES6 import semantics.feature/default_network_editable
parent
cb995d66da
commit
7a9f53c99d
@ -1,53 +1,61 @@ |
|||||||
import React from 'react' |
import React from 'react' |
||||||
import { storiesOf } from '@storybook/react' |
|
||||||
import TextField from '.' |
import TextField from '.' |
||||||
|
|
||||||
storiesOf('TextField', module) |
export default { |
||||||
.add('text', () => ( |
title: 'TextField', |
||||||
|
} |
||||||
|
|
||||||
|
export const text = () => ( |
||||||
<TextField |
<TextField |
||||||
label="Text" |
label="Text" |
||||||
type="text" |
type="text" |
||||||
/> |
/> |
||||||
)) |
) |
||||||
.add('password', () => ( |
|
||||||
|
export const password = () => ( |
||||||
<TextField |
<TextField |
||||||
label="Password" |
label="Password" |
||||||
type="password" |
type="password" |
||||||
/> |
/> |
||||||
)) |
) |
||||||
.add('error', () => ( |
|
||||||
|
export const error = () => ( |
||||||
<TextField |
<TextField |
||||||
type="text" |
type="text" |
||||||
label="Name" |
label="Name" |
||||||
error="Invalid value" |
error="Invalid value" |
||||||
/> |
/> |
||||||
)) |
) |
||||||
.add('Mascara text', () => ( |
|
||||||
|
export const mascaraText = () => ( |
||||||
<TextField |
<TextField |
||||||
label="Text" |
label="Text" |
||||||
type="text" |
type="text" |
||||||
largeLabel |
largeLabel |
||||||
/> |
/> |
||||||
)) |
) |
||||||
.add('Material text', () => ( |
|
||||||
|
export const materialText = () => ( |
||||||
<TextField |
<TextField |
||||||
label="Text" |
label="Text" |
||||||
type="text" |
type="text" |
||||||
theme="material" |
theme="material" |
||||||
/> |
/> |
||||||
)) |
) |
||||||
.add('Material password', () => ( |
|
||||||
|
export const materialPassword = () => ( |
||||||
<TextField |
<TextField |
||||||
label="Password" |
label="Password" |
||||||
type="password" |
type="password" |
||||||
theme="material" |
theme="material" |
||||||
/> |
/> |
||||||
)) |
) |
||||||
.add('Material error', () => ( |
|
||||||
|
export const materialError = () => ( |
||||||
<TextField |
<TextField |
||||||
type="text" |
type="text" |
||||||
label="Name" |
label="Name" |
||||||
error="Invalid value" |
error="Invalid value" |
||||||
theme="material" |
theme="material" |
||||||
/> |
/> |
||||||
)) |
) |
||||||
|
Loading…
Reference in new issue