-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathexamples.js
215 lines (196 loc) · 5.4 KB
/
examples.js
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
* Backpack - Skyscanner's Design System
*
* Copyright 2016 Skyscanner Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* @flow strict */
import { Fragment } from 'react';
import {
coreAccentDay,
surfaceHighlightDay,
} from '@skyscanner/bpk-foundations-web/tokens/base.es6';
import BpkCard, {
BpkDividedCard,
BpkCardWrapper,
ORIENTATION,
} from '../../packages/bpk-component-card';
import BpkText, { TEXT_STYLES } from '../../packages/bpk-component-text';
import { cssModules } from '../../packages/bpk-react-utils';
import * as STYLES from './examples.module.scss';
const getClassName = cssModules(STYLES);
const shortContent = 'Book your next trip on skyscanner.net.';
const longMessage = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sagittis sagittis purus, id
blandit ipsum. Pellentesque nec diam nec erat condimentum dapibus. Nunc diam augue, egestas id egestas ut, facilisis
nec mi. Donec et congue odio, nec laoreet est. Integer rhoncus varius arcu, a fringilla libero laoreet at. Mauris
porta varius ullamcorper. Sed laoreet libero mauris, non pretium lectus accumsan et. Suspendisse vehicula ullamcorper
sapien, et dapibus mi aliquet non. Pellentesque auctor sagittis lectus vitae rhoncus. Fusce id enim porttitor, mattis
ante in, vestibulum nulla.`;
const headerContent = (
<div className={getClassName('bpk-card-examples__header')}>
<BpkText tagName="span" textStyle={TEXT_STYLES.label1}>
Wrapper title
</BpkText>
</div>
);
const longContent = (
<Fragment>
<BpkText
tagName="h3"
textStyle={TEXT_STYLES.heading5}
style={{ marginBottom: '8px' }}
>
Let's explore
</BpkText>
<BpkText tagName="p">
It's your world and we'll help you explore it. Find the best
prices across millions of flights, hotels and car hire options to create
your perfect trip.
<br />
</BpkText>
</Fragment>
);
const DefaultExample = () => (
<BpkCard onClick={() => window.open('https://www.skyscanner.net/')}>
{shortContent}
</BpkCard>
);
const WithHrefExample = () => (
<BpkCard href="https://skyscanner.net">{shortContent}</BpkCard>
);
const WithoutPaddingExample = () => (
<BpkCard
padded={false}
onClick={() => window.open('https://www.skyscanner.net/')}
>
{shortContent}
</BpkCard>
);
const NonAtomicExample = () => (
<BpkCard
atomic={false}
onClick={() => window.open('https://www.skyscanner.net/')}
>
{longContent}
</BpkCard>
);
const NonAtomicHrefExample = () => (
<BpkCard atomic={false} href="https://www.skyscanner.net/">
{longContent}
</BpkCard>
);
const DefaultDividedCardExample = () => (
<BpkDividedCard
primaryContent={longMessage}
secondaryContent={shortContent}
/>
);
const VerticalDividedCardExample = () => (
<BpkDividedCard
primaryContent={longMessage}
secondaryContent={shortContent}
orientation={ORIENTATION.vertical}
/>
);
const WithHrefDividedCardExample = () => (
<BpkDividedCard
primaryContent={longMessage}
secondaryContent={shortContent}
href="http://www.skyscanner.net/"
/>
);
const NonElevatedDividedCardExample = () => (
<BpkDividedCard
primaryContent={longMessage}
secondaryContent={shortContent}
orientation={ORIENTATION.vertical}
isElevated={false}
/>
);
const CardWrapperExample = () => (
<BpkCardWrapper
backgroundColor={coreAccentDay}
card={
<BpkCard
atomic={false}
onClick={() => window.open('https://www.skyscanner.net/')}
>
{longContent}
</BpkCard>
}
header={headerContent}
/>
);
const DividedCardWrapperExample = () => (
<BpkCardWrapper
backgroundColor={coreAccentDay}
card={
<BpkDividedCard
primaryContent={longMessage}
secondaryContent={shortContent}
isElevated={false}
/>
}
header={headerContent}
/>
);
const WithClassNameWrapperExample = () => (
<BpkCardWrapper
backgroundColor={surfaceHighlightDay}
card={
<BpkCard
atomic={false}
onClick={() => window.open('https://www.skyscanner.net/')}
>
{longContent}
</BpkCard>
}
header={headerContent}
className={getClassName('bpk-card-examples__wrapper')}
/>
);
const MixedExample = () => (
<div>
<DefaultExample />
<br />
<WithoutPaddingExample />
<br />
<DefaultDividedCardExample />
<br />
<VerticalDividedCardExample />
<br />
<NonElevatedDividedCardExample />
<br />
<CardWrapperExample />
<br />
<DividedCardWrapperExample />
<br />
<WithClassNameWrapperExample />
</div>
);
export {
DefaultExample,
WithHrefExample,
WithoutPaddingExample,
NonAtomicExample,
NonAtomicHrefExample,
DefaultDividedCardExample,
VerticalDividedCardExample,
WithHrefDividedCardExample,
NonElevatedDividedCardExample,
CardWrapperExample,
DividedCardWrapperExample,
WithClassNameWrapperExample,
MixedExample,
};