This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
index.stories.jsx
159 lines (152 loc) · 4.1 KB
/
index.stories.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import React from 'react';
import { storiesOf } from '@storybook/react';
import styled from 'styled-components';
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
import { withServicesKnob } from '@bbc/psammead-storybook-helpers';
import { C_CLOUD_LIGHT } from '@bbc/psammead-styles/colours';
import { GEL_SPACING_HLF } from '@bbc/gel-foundations/spacings';
import { Headline, Link } from '@bbc/psammead-story-promo';
import notes from '../README.md';
import MediaIndicator from './index';
// To ensure the white box in the media indicator is visible.
const Page = styled.div`
background: ${C_CLOUD_LIGHT};
height: 100vh;
`;
const TimeDuration = styled.time`
margin: 0 ${GEL_SPACING_HLF};
`;
const StyledHeadline = styled(Headline)`
display: inline;
`;
const PageDecorator = storyFn => <Page>{storyFn()}</Page>;
storiesOf('Components|MediaIndicator/Video', module)
.addDecorator(PageDecorator)
.addDecorator(withKnobs)
.addDecorator(withServicesKnob())
.add(
'video without duration',
({ script, service, dir }) => (
<MediaIndicator
type="video"
script={script}
dir={dir}
service={service}
/>
),
{ notes },
)
.add(
'video with duration',
({ script, service, dir }) => (
<MediaIndicator type="video" script={script} service={service} dir={dir}>
<TimeDuration dateTime={text('datetime', 'PT2M15S')}>
{text('duration', '2:15')}
</TimeDuration>
</MediaIndicator>
),
{ notes },
)
.add(
'inline video media indicator with headline',
({ script, service, dir }) => (
<>
<MediaIndicator
type="video"
script={script}
service={service}
dir={dir}
isInline={boolean('inline?', true)}
/>
<StyledHeadline script={script} service={service} promoHasImage={false}>
<Link href="https://www.bbc.co.uk/news">
{text('extra text', 'example text')}
</Link>
</StyledHeadline>
</>
),
{ notes },
);
storiesOf('Components|MediaIndicator/Audio', module)
.addDecorator(PageDecorator)
.addDecorator(withKnobs)
.addDecorator(withServicesKnob())
.add(
'audio without duration',
({ script, service, dir }) => (
<MediaIndicator
type="audio"
script={script}
service={service}
dir={dir}
/>
),
{ notes },
)
.add(
'audio with duration',
({ script, service, dir }) => (
<MediaIndicator type="audio" script={script} service={service} dir={dir}>
<time dateTime={text('datetime', 'PT2M15S')}>
{text('duration', '2:15')}
</time>
</MediaIndicator>
),
{ notes },
)
.add(
'inline audio media indicator with headline',
({ script, service, dir }) => (
<>
<MediaIndicator
type="audio"
script={script}
service={service}
dir={dir}
isInline={boolean('inline?', true)}
/>
<StyledHeadline script={script} service={service} promoHasImage={false}>
<Link href="https://www.bbc.co.uk/news">
{text('extra text', 'example text')}
</Link>
</StyledHeadline>
</>
),
{ notes },
);
storiesOf('Components|MediaIndicator/Photo', module)
.addDecorator(PageDecorator)
.addDecorator(withKnobs)
.addDecorator(withServicesKnob())
.add(
'photogallery',
({ script, service, dir }) => (
<MediaIndicator
type="photogallery"
script={script}
service={service}
dir={dir}
/>
),
{ notes },
)
.add(
'inline photogallery with headline',
({ script, service, dir }) => (
<>
<MediaIndicator
type="photogallery"
script={script}
service={service}
dir={dir}
isInline={boolean('inline?', true)}
/>
<StyledHeadline script={script} service={service} promoHasImage={false}>
<Link href="https://www.bbc.co.uk/news">
{text('extra text', 'example text')}
</Link>
</StyledHeadline>
</>
),
{ notes },
);