Skip to content

Commit faf67da

Browse files
committed
Convert Loader to styled component
1 parent 91e5b79 commit faf67da

File tree

3 files changed

+53
-59
lines changed

3 files changed

+53
-59
lines changed
Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,55 @@
11
import React from 'react';
2+
import styled, { keyframes } from 'styled-components';
3+
import { prop, remSize } from '../../../theme';
4+
5+
const skBounce = keyframes`
6+
0%, 100% {
7+
transform: scale(0.0);
8+
}
9+
50% {
10+
transform: scale(1.0);
11+
}
12+
`;
13+
const Container = styled.div`
14+
&&& {
15+
width: 100%;
16+
height: 100%;
17+
display: flex;
18+
justify-content: center;
19+
align-items: center;
20+
background-color: ${prop('backgroundColor')};
21+
}
22+
`;
23+
const LoaderWrapper = styled.div`
24+
&&& {
25+
width: ${remSize(80)};
26+
height: ${remSize(80)};
27+
position: relative;
28+
}
29+
`;
30+
const LoaderCircle = styled.div`
31+
&&& {
32+
width: 100%;
33+
height: 100%;
34+
border-radius: 80%;
35+
background-color: ${prop('logoColor')};
36+
opacity: 0.6;
37+
position: absolute;
38+
top: 0;
39+
left: 0;
40+
animation: ${skBounce} 2s infinite ease-in-out;
41+
&:nth-child(2) {
42+
animation-delay: -1s;
43+
}
44+
}
45+
`;
246

347
const Loader = () => (
4-
<div className="loader-container">
5-
<div className="loader">
6-
<div className="loader__circle1" />
7-
<div className="loader__circle2" />
8-
</div>
9-
</div>
48+
<Container>
49+
<LoaderWrapper>
50+
<LoaderCircle />
51+
<LoaderCircle />
52+
</LoaderWrapper>
53+
</Container>
1054
);
1155
export default Loader;

client/styles/components/_loader.scss

Lines changed: 0 additions & 53 deletions
This file was deleted.

client/theme.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const baseThemes = {
7575
inactiveTextColor: grays.middleDark,
7676
backgroundColor: grays.lighter,
7777
accentColor: colors.p5jsPink,
78+
logoColor: colors.p5jsPink,
7879

7980
Button: {
8081
primary: {
@@ -162,6 +163,7 @@ const baseThemes = {
162163
inactiveTextColor: grays.middleLight,
163164
backgroundColor: grays.darker,
164165
accentColor: colors.p5jsPink,
166+
logoColor: colors.p5jsPink,
165167

166168
Button: {
167169
primary: {
@@ -248,6 +250,7 @@ export default {
248250
...baseThemes,
249251
[Theme.contrast]: extend(baseThemes[Theme.dark], {
250252
inactiveTextColor: grays.light,
253+
logoColor: colors.yellow,
251254

252255
Button: {
253256
primary: {

0 commit comments

Comments
 (0)