Skip to content

Commit 01973d0

Browse files
committed
Converted Tag to a React Component
1 parent d3f0dd6 commit 01973d0

File tree

6 files changed

+31
-34
lines changed

6 files changed

+31
-34
lines changed

src/__tests__/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import * as index from '../index';
22

33
describe('Index', () => {
44
it('contains all expected elements', () => {
5-
expect(Object.keys(index)).toEqual(['SubNavigation']);
5+
expect(Object.keys(index)).toEqual(['SubNavigation', 'Tag']);
66
});
77
});

src/all.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
// SubNavigation Component
55
@import './components/sub-navigation/SubNavigation';
66

7-
// Tag Styling
8-
@import './styles/tag';
7+
// Tag Component
8+
@import './components/tag/Tag';

src/components.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SubNavigation Component
22
@import './components/sub-navigation/SubNavigation';
33

4-
// Tag Styling
5-
@import './styles/tag';
4+
// Tag Component
5+
@import './components/tag/Tag';

src/styles/_tag.scss src/components/tag/_Tag.scss

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
@import 'variables';
2-
@import 'core';
1+
@import '../../styles/variables';
32

43
/* ==========================================================================
54
#TAG

src/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
// Remove the next line once there is a second export.
2-
// eslint-disable-next-line import/prefer-default-export
31
export { default as SubNavigation } from './components/sub-navigation';
2+
export { default as Tag } from './components/tag';

stories/Tag.stories.tsx

+24-25
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
import React from 'react';
22
import { storiesOf } from '@storybook/react';
3+
import { Tag } from '../src';
34

45
const stories = storiesOf('Tags', module);
56

6-
stories.add('Basic', () => {
7-
return (
7+
stories
8+
.add('Basic', () => (
89
<div className="tag-demo">
9-
<span className="nhsuk-tag">Standard</span>
10-
<span className="nhsuk-tag">Done</span>
11-
<span className="nhsuk-tag nhsuk-tag--white"> Started </span>
12-
<span className="nhsuk-tag nhsuk-tag--grey"> Not Started </span>
13-
<span className="nhsuk-tag nhsuk-tag--blue"> Ready to submit </span>
14-
<span className="nhsuk-tag nhsuk-tag--red"> FP69 </span>
15-
<span className="nhsuk-tag nhsuk-tag--orange"> Ceased - no cervix </span>
10+
<Tag>Standard</Tag>
11+
<Tag>Done</Tag>
12+
<Tag color="white">Started</Tag>
13+
<Tag color="grey">Not Started</Tag>
14+
<Tag color="blue">Ready to submit</Tag>
15+
<Tag color="red">FP69</Tag>
16+
<Tag color="orange">Ceased - no cervix</Tag>
1617
</div>
17-
);
18-
}).add('Colours', () => {
19-
return (
18+
))
19+
.add('Colours', () => (
2020
<div className="tag-demo">
21-
<span className="nhsuk-tag">Standard</span>
22-
<span className="nhsuk-tag nhsuk-tag--white"> Started </span>
23-
<span className="nhsuk-tag nhsuk-tag--grey"> Not Started </span>
24-
<span className="nhsuk-tag nhsuk-tag--green"> New </span>
25-
<span className="nhsuk-tag nhsuk-tag--aqua-green"> Active </span>
26-
<span className="nhsuk-tag nhsuk-tag--blue"> Pending </span>
27-
<span className="nhsuk-tag nhsuk-tag--purple"> Received </span>
28-
<span className="nhsuk-tag nhsuk-tag--pink"> Sent </span>
29-
<span className="nhsuk-tag nhsuk-tag--red"> Rejected </span>
30-
<span className="nhsuk-tag nhsuk-tag--orange"> Declined </span>
31-
<span className="nhsuk-tag nhsuk-tag--yellow"> Delayed </span>
21+
<Tag>Standard</Tag>
22+
<Tag color="white">Started</Tag>
23+
<Tag color="grey">Not Started</Tag>
24+
<Tag color="green">New</Tag>
25+
<Tag color="aqua-green">Active</Tag>
26+
<Tag color="blue">Pending</Tag>
27+
<Tag color="purple">Received</Tag>
28+
<Tag color="pink">Sent</Tag>
29+
<Tag color="red">Rejected</Tag>
30+
<Tag color="orange">Declined</Tag>
31+
<Tag color="yellow">Delayed</Tag>
3232
</div>
33-
);
34-
});
33+
));

0 commit comments

Comments
 (0)