Skip to content

Commit f242250

Browse files
committed
New theme for counter
1 parent 00b302e commit f242250

File tree

4 files changed

+101
-22
lines changed

4 files changed

+101
-22
lines changed

src/shared/components/Contentful/Countdown/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default function CountdownLoader(props) {
2525
title={data.entries.items[id].fields.title}
2626
end={new Date(data.entries.items[id].fields.endDate)}
2727
extraStylesForContainer={data.entries.items[id].fields.extraStylesForContainer}
28+
themeName={data.entries.items[id].fields.theme}
2829
/>
2930
)}
3031
renderPlaceholder={LoadingIndicator}

src/shared/components/Countdown/index.jsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ import PT from 'prop-types';
88
import React from 'react';
99
import { fixStyle } from 'utils/contentful';
1010

11-
import './style.scss';
11+
import defaultTheme from './themes/style.scss';
12+
import TCO21 from './themes/TCO21.scss';
13+
14+
const THEMES = {
15+
Default: defaultTheme,
16+
TCO21,
17+
};
1218

1319
/* We have to use state component, as we need to manipulate with DOM nodes to
1420
* access nuka-carousel state. */
@@ -34,6 +40,8 @@ export default class Countdown extends React.Component {
3440
}
3541

3642
render() {
43+
const { themeName } = this.props;
44+
const theme = THEMES[themeName];
3745
let { elapsed } = this.state;
3846
const oneDay = 24 * 60 * 60;
3947
const oneHour = 60 * 60;
@@ -54,27 +62,26 @@ export default class Countdown extends React.Component {
5462
);
5563
return (
5664
<div
57-
styleName="container"
65+
className={theme.container}
5866
style={styles}
5967
>
60-
<div styleName="title"> {title} </div>
61-
<div styleName="title colon"> : </div>
62-
<div styleName="time-container">
68+
<div className={theme.title}> {title} </div>
69+
<div className={theme['time-container']}>
6370
<div>
64-
<div styleName="time-value"> {day} </div>
65-
<div styleName="time-label"> days </div>
71+
<div className={theme['time-value']}> {day} </div>
72+
<div className={theme['time-label']}> days </div>
6673
</div>
6774
<div>
68-
<div styleName="time-value"> {hour} </div>
69-
<div styleName="time-label"> hours </div>
75+
<div className={theme['time-value']}> {hour} </div>
76+
<div className={theme['time-label']}> hours </div>
7077
</div>
7178
<div>
72-
<div styleName="time-value"> {minute} </div>
73-
<div styleName="time-label"> minutes </div>
79+
<div className={theme['time-value']}> {minute} </div>
80+
<div className={theme['time-label']}> minutes </div>
7481
</div>
75-
<div styleName="time-second">
76-
<div styleName="time-value"> {second} </div>
77-
<div styleName="time-label"> seconds </div>
82+
<div className={theme['time-second']}>
83+
<div className={theme['time-value']}> {second} </div>
84+
<div className={theme['time-label']}> seconds </div>
7885
</div>
7986
</div>
8087
</div>
@@ -85,10 +92,12 @@ export default class Countdown extends React.Component {
8592
Countdown.defaultProps = {
8693
title: 'Countdown to TCO19 Final',
8794
extraStylesForContainer: {},
95+
themeName: 'Default',
8896
};
8997

9098
Countdown.propTypes = {
9199
title: PT.string,
92100
end: PT.instanceOf(Date).isRequired,
93101
extraStylesForContainer: PT.shape(),
102+
themeName: PT.string,
94103
};
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
@import "~styles/mixins";
2+
3+
$text-color-gray: #37373b;
4+
$container-background-yello: #fce217;
5+
6+
.container {
7+
@include roboto-regular;
8+
9+
display: -webkit-flex; /* Safari */
10+
display: flex;
11+
-webkit-flex-direction: row; /* Safari */
12+
flex-direction: row;
13+
-webkit-justify-content: center; /* Safari */
14+
justify-content: center;
15+
padding: 40px;
16+
background: $container-background-yello;
17+
18+
@media only screen and (max-width: 767px) {
19+
-webkit-flex-direction: column; /* Safari */
20+
flex-direction: column;
21+
}
22+
23+
.title {
24+
@include barlow-condensed-medium;
25+
26+
color: #2a2a2a;
27+
font-size: 48px;
28+
line-height: 50px;
29+
text-align: center;
30+
margin: auto 41px auto 0;
31+
text-transform: uppercase;
32+
33+
@media only screen and (max-width: 767px) {
34+
margin-bottom: 20px;
35+
}
36+
}
37+
38+
.time-container {
39+
display: -webkit-flex; /* Safari */
40+
display: flex;
41+
-webkit-flex-direction: row; /* Safari */
42+
flex-direction: row;
43+
-webkit-justify-content: center; /* Safari */
44+
justify-content: center;
45+
}
46+
47+
.time-value {
48+
@include barlow-condensed;
49+
50+
color: #9d41c9;
51+
font-size: 80px;
52+
line-height: 74px;
53+
text-align: center;
54+
}
55+
56+
.time-label {
57+
color: #2a2a2a;
58+
font-size: 14px;
59+
letter-spacing: 0.5px;
60+
line-height: 18px;
61+
text-align: center;
62+
width: 100px;
63+
text-transform: uppercase;
64+
margin-top: 4px;
65+
66+
@media only screen and (max-width: 767px) {
67+
width: auto;
68+
margin-left: 10px;
69+
margin-right: 10px;
70+
font-size: 18px;
71+
}
72+
}
73+
74+
.time-second {
75+
display: block;
76+
}
77+
}

src/shared/components/Countdown/style.scss renamed to src/shared/components/Countdown/themes/style.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,8 @@ $container-background-yello: #fce217;
3131
margin-bottom: auto;
3232
text-transform: uppercase;
3333

34-
&.colon {
35-
margin-right: 30px;
36-
}
37-
3834
@media only screen and (max-width: 767px) {
3935
margin-bottom: 20px;
40-
41-
&.colon {
42-
display: none;
43-
}
4436
}
4537
}
4638

0 commit comments

Comments
 (0)