Skip to content

Commit 736cc60

Browse files
authored
Merge pull request #2980 from adityagarg06/loader/styled_component
Use styled-components in Loader
2 parents 5226e25 + 893df26 commit 736cc60

File tree

6 files changed

+68
-72
lines changed

6 files changed

+68
-72
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"import/named": 0,
1515
"import/namespace": 0,
1616
"import/no-unresolved": 0,
17-
"import/no-named-as-default": 2,
17+
"import/no-named-as-default": 0,
18+
"import/no-named-as-default-member": 0,
1819
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
1920
"indent": 0,
2021
"no-console": 0,

client/index.jsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@ const initialState = window.__INITIAL_STATE__;
2121
const store = configureStore(initialState);
2222

2323
const App = () => (
24-
<Provider store={store}>
25-
<ThemeProvider>
26-
<Router history={browserHistory}>
27-
<SkipLink targetId="play-sketch" text="PlaySketch" />
28-
<Routing />
29-
</Router>
30-
</ThemeProvider>
31-
</Provider>
24+
<>
25+
<Router history={browserHistory}>
26+
<SkipLink targetId="play-sketch" text="PlaySketch" />
27+
<Routing />
28+
</Router>
29+
</>
3230
);
3331

3432
render(
35-
<Suspense fallback={<Loader />}>
36-
<App />
37-
</Suspense>,
33+
<Provider store={store}>
34+
<ThemeProvider>
35+
<Suspense fallback={<Loader />}>
36+
<App />
37+
</Suspense>
38+
</ThemeProvider>
39+
</Provider>,
3840
document.getElementById('root')
3941
);
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/styles/main.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
@import 'components/copyable-input';
4747
@import 'components/feedback';
4848
@import 'components/console-input';
49-
@import 'components/loader';
5049
@import 'components/uploader';
5150
@import 'components/tabs';
5251
@import 'components/dashboard-header';

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
modalBorderColor: grays.middleLight,
7980
searchBackgroundColor: grays.lightest,
8081
tableRowStripeColor: grays.mediumLight,
@@ -165,6 +166,7 @@ const baseThemes = {
165166
inactiveTextColor: grays.middleLight,
166167
backgroundColor: grays.darker,
167168
accentColor: colors.p5jsPink,
169+
logoColor: colors.p5jsPink,
168170
modalBorderColor: grays.middleDark,
169171
searchBackgroundColor: grays.darker,
170172
tableRowStripeColor: grays.dark,
@@ -254,6 +256,7 @@ export default {
254256
...baseThemes,
255257
[Theme.contrast]: extend(baseThemes[Theme.dark], {
256258
inactiveTextColor: grays.light,
259+
logoColor: colors.yellow,
257260

258261
Button: {
259262
primary: {

0 commit comments

Comments
 (0)