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 { storiesOf } from '@storybook/react' |
||||
import TextField from '.' |
||||
|
||||
storiesOf('TextField', module) |
||||
.add('text', () => ( |
||||
export default { |
||||
title: 'TextField', |
||||
} |
||||
|
||||
export const text = () => ( |
||||
<TextField |
||||
label="Text" |
||||
type="text" |
||||
/> |
||||
)) |
||||
.add('password', () => ( |
||||
) |
||||
|
||||
export const password = () => ( |
||||
<TextField |
||||
label="Password" |
||||
type="password" |
||||
/> |
||||
)) |
||||
.add('error', () => ( |
||||
) |
||||
|
||||
export const error = () => ( |
||||
<TextField |
||||
type="text" |
||||
label="Name" |
||||
error="Invalid value" |
||||
/> |
||||
)) |
||||
.add('Mascara text', () => ( |
||||
) |
||||
|
||||
export const mascaraText = () => ( |
||||
<TextField |
||||
label="Text" |
||||
type="text" |
||||
largeLabel |
||||
/> |
||||
)) |
||||
.add('Material text', () => ( |
||||
) |
||||
|
||||
export const materialText = () => ( |
||||
<TextField |
||||
label="Text" |
||||
type="text" |
||||
theme="material" |
||||
/> |
||||
)) |
||||
.add('Material password', () => ( |
||||
) |
||||
|
||||
export const materialPassword = () => ( |
||||
<TextField |
||||
label="Password" |
||||
type="password" |
||||
theme="material" |
||||
/> |
||||
)) |
||||
.add('Material error', () => ( |
||||
) |
||||
|
||||
export const materialError = () => ( |
||||
<TextField |
||||
type="text" |
||||
label="Name" |
||||
error="Invalid value" |
||||
theme="material" |
||||
/> |
||||
)) |
||||
) |
||||
|
Loading…
Reference in new issue