Skip to content

Commit 8339a6e

Browse files
committed
Merge branch 'master' of github.com:NHSDigital/nhsuk-react-components
2 parents ab27f21 + a451b21 commit 8339a6e

File tree

2 files changed

+60
-9
lines changed

2 files changed

+60
-9
lines changed

stories/FormElementBehaviour/DateInput.stories.tsx

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DateInput, Form } from '../../src';
55

66
const stories = storiesOf('FormElementBehaviour: DateInput', module);
77

8-
stories.add('Standard', () => (
8+
stories.add('Standard', () => (
99
<div style={{ padding: 20 }}>
1010
<h2>Scenario: onChange and onInput handlers are bound without any other props</h2>
1111
<h5>Expected Behaviour</h5>
@@ -15,12 +15,12 @@ stories.add('Standard', () => (
1515
</ul>
1616
<h5>Component</h5>
1717
<Form>
18-
<DateInput onChange={e => console.log(e.target.value)} hint="Test hint" label="Test label"/>
18+
<DateInput onChange={e => console.log(e.target.value)} hint="Test hint" label="Test label" />
1919
</Form>
2020
</div>
2121
));
2222

23-
stories.add('Standard with Error', () => (
23+
stories.add('Standard with Error', () => (
2424
<div style={{ padding: 20 }}>
2525
<h2>Scenario: onChange and onInput handlers are bound without any other props</h2>
2626
<h5>Expected Behaviour</h5>
@@ -29,16 +29,35 @@ stories.add('Standard with Error', () => (
2929
<li>The value is passed through</li>
3030
</ul>
3131
<h5>Component</h5>
32-
<Form error={true}>
33-
<DateInput onChange={e => console.log(e.target.value)} error="Test Error" hint="Test hint" label="Test label"/>
32+
<Form error>
33+
<DateInput onChange={e => console.log(e.target.value)} error="Test Error" hint="Test hint" label="Test label" />
3434
</Form>
3535
<h5>Component with specific field errors</h5>
36-
<Form error={true}>
36+
<Form error>
3737
<DateInput onChange={e => console.log(e.target.value)} error="Test Error" hint="Test hint" label="Test label">
38-
<DateInput.Day error={false}/>
39-
<DateInput.Month/>
40-
<DateInput.Year/>
38+
<DateInput.Day error={false} />
39+
<DateInput.Month />
40+
<DateInput.Year />
4141
</DateInput>
4242
</Form>
4343
</div>
4444
));
45+
46+
stories.add('Pre-populated', () => {
47+
const initialValue = { day: '20', month: '09', year: '1996' };
48+
return (
49+
<div style={{ padding: 20 }}>
50+
<h5>Component</h5>
51+
<Form>
52+
<DateInput
53+
hint="Test hint"
54+
label="Test label"
55+
>
56+
<DateInput.Day value={initialValue.day} />
57+
<DateInput.Month value={initialValue.month} />
58+
<DateInput.Year value={initialValue.year} />
59+
</DateInput>
60+
</Form>
61+
</div>
62+
);
63+
});

stories/Grid.stories.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
import React from 'react';
3+
import { storiesOf } from '@storybook/react';
4+
import centered from '@storybook/addon-centered';
5+
import { Row, Col, Panel, Container } from '../src';
6+
7+
const stories = storiesOf('Grid', module);
8+
9+
stories
10+
.addDecorator(centered)
11+
.add('Grid', () => (
12+
<Container>
13+
<Row>
14+
<Col width="full"><Panel>full column</Panel></Col>
15+
</Row>
16+
<Row>
17+
<Col width="one-half"><Panel>one-half column</Panel></Col>
18+
<Col width="one-half"><Panel>one-half column</Panel></Col>
19+
</Row>
20+
<Row>
21+
<Col width="one-third"><Panel>one-third column</Panel></Col>
22+
<Col width="one-third"><Panel>one-third column</Panel></Col>
23+
<Col width="one-third"><Panel>one-third column</Panel></Col>
24+
</Row>
25+
<Row>
26+
<Col width="one-quarter"><Panel>one-quarter column</Panel></Col>
27+
<Col width="one-quarter"><Panel>one-quarter column</Panel></Col>
28+
<Col width="one-quarter"><Panel>one-quarter column</Panel></Col>
29+
<Col width="one-quarter"><Panel>one-quarter column</Panel></Col>
30+
</Row>
31+
</Container>
32+
));

0 commit comments

Comments
 (0)