Skip to content

Commit 4491bc2

Browse files
committed
Add spinner to EmailLogin
1 parent 24553e4 commit 4491bc2

File tree

1 file changed

+112
-1
lines changed

1 file changed

+112
-1
lines changed

src/containers/etc/EmailLogin.tsx

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import storage from '../../lib/storage';
88
import { RootState } from '../../modules';
99
import { setUser } from '../../modules/core';
1010
import { useApolloClient } from '@apollo/react-hooks';
11+
import styled from 'styled-components';
12+
import palette from '../../lib/styles/palette';
13+
import { toast } from 'react-toastify';
1114

1215
const mapStateToProps = (state: RootState) => ({});
1316
const mapDispatchToProps = {
@@ -42,19 +45,127 @@ const EmailLogin: React.FC<EmailLoginProps> = ({ location, history }) => {
4245
history.replace('/');
4346
} catch (e) {
4447
// TODO: show 401
48+
toast.error('잘못된 접근입니다.');
4549
history.replace('/');
4650
}
4751
}, [client, history, query.code]);
4852
useEffect(() => {
4953
if (!query.code) {
5054
// TODO: show 404
55+
toast.error('잘못된 접근입니다.');
5156
history.replace('/');
5257
}
5358
processLogin();
5459
}, [history, location.search, processLogin, query.code]);
55-
return null;
60+
61+
return (
62+
<Fullscreen>
63+
<SpinnerBlock>
64+
<div className="sk-chase-dot"></div>
65+
<div className="sk-chase-dot"></div>
66+
<div className="sk-chase-dot"></div>
67+
<div className="sk-chase-dot"></div>
68+
<div className="sk-chase-dot"></div>
69+
<div className="sk-chase-dot"></div>
70+
</SpinnerBlock>
71+
</Fullscreen>
72+
);
5673
};
5774

75+
const Fullscreen = styled.div`
76+
width: 100%;
77+
height: 100%;
78+
display: flex;
79+
align-items: center;
80+
justify-content: center;
81+
`;
82+
83+
const SpinnerBlock = styled.div`
84+
width: 100px;
85+
height: 100px;
86+
position: relative;
87+
animation: sk-chase 2.5s infinite linear both;
88+
89+
.sk-chase-dot {
90+
width: 100%;
91+
height: 100%;
92+
position: absolute;
93+
left: 0;
94+
top: 0;
95+
animation: sk-chase-dot 2s infinite ease-in-out both;
96+
}
97+
98+
.sk-chase-dot:before {
99+
content: '';
100+
display: block;
101+
width: 25%;
102+
height: 25%;
103+
background-color: ${palette.teal6};
104+
border-radius: 100%;
105+
animation: sk-chase-dot-before 2s infinite ease-in-out both;
106+
}
107+
108+
.sk-chase-dot:nth-child(1) {
109+
animation-delay: -1.1s;
110+
}
111+
.sk-chase-dot:nth-child(2) {
112+
animation-delay: -1s;
113+
}
114+
.sk-chase-dot:nth-child(3) {
115+
animation-delay: -0.9s;
116+
}
117+
.sk-chase-dot:nth-child(4) {
118+
animation-delay: -0.8s;
119+
}
120+
.sk-chase-dot:nth-child(5) {
121+
animation-delay: -0.7s;
122+
}
123+
.sk-chase-dot:nth-child(6) {
124+
animation-delay: -0.6s;
125+
}
126+
.sk-chase-dot:nth-child(1):before {
127+
animation-delay: -1.1s;
128+
}
129+
.sk-chase-dot:nth-child(2):before {
130+
animation-delay: -1s;
131+
}
132+
.sk-chase-dot:nth-child(3):before {
133+
animation-delay: -0.9s;
134+
}
135+
.sk-chase-dot:nth-child(4):before {
136+
animation-delay: -0.8s;
137+
}
138+
.sk-chase-dot:nth-child(5):before {
139+
animation-delay: -0.7s;
140+
}
141+
.sk-chase-dot:nth-child(6):before {
142+
animation-delay: -0.6s;
143+
}
144+
145+
@keyframes sk-chase {
146+
100% {
147+
transform: rotate(360deg);
148+
}
149+
}
150+
151+
@keyframes sk-chase-dot {
152+
80%,
153+
100% {
154+
transform: rotate(360deg);
155+
}
156+
}
157+
158+
@keyframes sk-chase-dot-before {
159+
50% {
160+
transform: scale(0.4);
161+
}
162+
100%,
163+
0% {
164+
transform: scale(1);
165+
}
166+
}
167+
`;
168+
58169
export default connect<StateProps, DispatchProps, OwnProps, RootState>(
59170
mapStateToProps,
60171
mapDispatchToProps,

0 commit comments

Comments
 (0)