Skip to content

Commit 4fd4511

Browse files
committedMar 5, 2020
Add success page (for email unsubscription)
1 parent fe2d09e commit 4fd4511

File tree

5 files changed

+76
-5
lines changed

5 files changed

+76
-5
lines changed
 

‎asset-license.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Icons made by [Smashicons](https://www.flaticon.com/authors/smashicons) from [ww
88

99
Heart Icon: https://iconmonstr.com/favorite-8-svg/
1010
Clip Icon: https://iconmonstr.com/paperclip-2-svg/
11-
11+
Check Icon: https://iconmonstr.com/check-mark-1-svg/

‎src/App.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ const loadableConfig = {
2121
const VelogPage = loadable(() => import('./pages/velog/VelogPage'), {
2222
fallback: <VelogPageFallback />,
2323
});
24-
const MainPage = loadable(
25-
() => import('./pages/main/MainPage'),
26-
loadableConfig,
27-
);
24+
2825
const EmailLoginPage = loadable(
2926
() => import('./pages/EmailLoginPage'),
3027
loadableConfig,
@@ -41,6 +38,7 @@ const SettingPage = loadable(
4138
() => import('./pages/SettingPage'),
4239
loadableConfig,
4340
);
41+
const SuccessPage = loadable(() => import('./pages/SuccessPage'));
4442

4543
interface AppProps {}
4644

@@ -74,6 +72,7 @@ const App: React.FC<AppProps> = props => {
7472
<Route path="/tags" component={TagsPage} />
7573
<Route path={['/policy/:type?']} component={PolicyPage} />
7674
<Route path="/setting" component={SettingPage} />
75+
<Route path="/success" component={SuccessPage} />
7776
<Route component={NotFoundPage} />
7877
</Switch>
7978
</ErrorBoundary>

‎src/pages/SuccessPage.tsx

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import { CheckIcon } from '../static/svg';
4+
import palette from '../lib/styles/palette';
5+
import Button from '../components/common/Button';
6+
import { RouteComponentProps } from 'react-router-dom';
7+
import media from '../lib/styles/media';
8+
import qs from 'qs';
9+
10+
export type SuccessPageProps = {} & RouteComponentProps;
11+
12+
const messages = {
13+
unsubscribe_email:
14+
'이메일 구독이 해지되었습니다.\n설정에서 다시 활성화 할 수 있습니다.',
15+
};
16+
17+
type MessageTypes = keyof typeof messages;
18+
19+
function SuccessPage({ history, location }: SuccessPageProps) {
20+
const { type } = qs.parse(location.search, {
21+
ignoreQueryPrefix: true,
22+
}) as { type?: MessageTypes };
23+
24+
const message = type ? messages[type] : '성공!';
25+
26+
return (
27+
<Block>
28+
<CheckIcon />
29+
<div className="message">{message}</div>
30+
<div className="button-wrapper">
31+
<Button onClick={() => history.push('/')}>홈으로</Button>
32+
</div>
33+
</Block>
34+
);
35+
}
36+
37+
const Block = styled.div`
38+
width: 100%;
39+
height: 100%;
40+
display: flex;
41+
align-items: center;
42+
flex-direction: column;
43+
justify-content: center;
44+
svg {
45+
fill: ${palette.teal5};
46+
width: 5rem;
47+
height: 5rem;
48+
}
49+
.message {
50+
margin-top: 2rem;
51+
font-size: 1.5rem;
52+
white-space: pre;
53+
text-align: center;
54+
line-height: 1.5;
55+
}
56+
.button-wrapper {
57+
color: ${palette.gray8};
58+
margin-top: 1.5rem;
59+
}
60+
61+
${media.medium} {
62+
padding-left: 1rem;
63+
padding-right: 1rem;
64+
.message {
65+
font-size: 1rem;
66+
}
67+
}
68+
`;
69+
70+
export default SuccessPage;

‎src/static/svg/icon-check.svg

+1
Loading

‎src/static/svg/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ export { ReactComponent as ShareIcon2 } from './icon-share-2.svg';
1919
export { ReactComponent as SearchIcon } from './icon-search.svg'; // iconmonstr-magnifier-3
2020
export { ReactComponent as SearchIcon2 } from './icon-search-2.svg';
2121
export { ReactComponent as VelogIcon } from './velog-icon.svg';
22+
export { ReactComponent as CheckIcon } from './icon-check.svg';

0 commit comments

Comments
 (0)
Please sign in to comment.