Skip to content

Commit 1063edb

Browse files
authored
[FEAT] Add font (#63)
* [FEAT] Apply fonts * [FEAT] Extract globalStyles
1 parent d9a6c55 commit 1063edb

File tree

10 files changed

+84
-62
lines changed

10 files changed

+84
-62
lines changed

src/App.js

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,12 @@
11
import React from 'react';
22
import { BrowserRouter, Route, Switch } from 'react-router-dom';
3-
import { createGlobalStyle } from 'styled-components';
43

4+
import GlobalStyle from './globalStyles';
55
import Theme from './Theme';
66
import Home from './pages/Home';
77
import Question from './pages/Question';
88
import Result from './pages/Result';
99

10-
const GlobalStyle = createGlobalStyle`
11-
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;500&display=swap');
12-
html, body, div, span, applet, object, iframe,
13-
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
14-
a, abbr, acronym, address, big, cite, code,
15-
del, dfn, em, img, ins, kbd, q, s, samp,
16-
small, strike, strong, sub, sup, tt, var,
17-
b, u, i, center,
18-
dl, dt, dd, ol, ul, li,
19-
fieldset, form, label, legend,
20-
table, caption, tbody, tfoot, thead, tr, th, td,
21-
article, aside, canvas, details, embed,
22-
figure, figcaption, footer, header, hgroup,
23-
menu, nav, output, ruby, section, summary,
24-
time, mark, audio, video {
25-
margin: 0;
26-
padding: 0;
27-
border: 0;
28-
font-size: inherit;
29-
vertical-align: baseline;
30-
word-break: keep-all;
31-
-webkit-font-smoothing: antialiased;
32-
}
33-
a {
34-
color: inherit;
35-
text-decoration: none;
36-
}
37-
ol, ul {
38-
list-style: none;
39-
}
40-
blockquote, q {
41-
quotes: none;
42-
}
43-
blockquote:before, blockquote:after,
44-
q:before, q:after {
45-
content: '';
46-
content: none;
47-
}
48-
table {
49-
border-collapse: collapse;
50-
border-spacing: 0;
51-
}
52-
body {
53-
display: flex;
54-
justify-content: center;
55-
width: 100%;
56-
min-height: 100vh;
57-
line-height: ${({ theme }) => theme.spacing(1)};
58-
font-family: ${({ theme }) => theme.fonts[0]} !important;
59-
background-color: ${({ theme }) => theme.color.dark};
60-
}
61-
#root {
62-
width: 100%;
63-
max-width: 414px;
64-
padding: ${({ theme }) => theme.spacing(5)} ${({ theme }) =>
65-
theme.spacing(2)};
66-
}
67-
`;
68-
6910
const App = () => (
7011
<BrowserRouter>
7112
<Theme>

src/Theme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const theme = {
1313
light: '#FFF',
1414
},
1515
spacing: (size) => `${size / 2}rem`,
16-
fonts: ['Noto Sans KR', 'sans-serif'],
1716
fontSize: {
1817
sm: '0.825rem',
1918
md: '1.125rem',
368 KB
Binary file not shown.
242 KB
Binary file not shown.
166 KB
Binary file not shown.
364 KB
Binary file not shown.
243 KB
Binary file not shown.
166 KB
Binary file not shown.

src/components/Loading.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ const Spinner = styled.div`
4040
const Text = styled.span`
4141
margin-top: ${({ theme }) => theme.spacing(2.5)};
4242
font-size: ${({ theme }) => theme.fontSize.md};
43-
font-weight: 700;
43+
font-weight: 500;
4444
color: ${({ theme }) => theme.color.light};
4545
`;

src/globalStyles.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import { createGlobalStyle } from 'styled-components';
2+
3+
import NotoSansKRDemiLightOtf from '@/assets/fonts/NotoSansKR-DemiLight.otf';
4+
import NotoSansKRDemiLightWoff from '@/assets/fonts/NotoSansKR-DemiLight.woff';
5+
import NotoSansKRDemiLightWoff2 from '@/assets/fonts/NotoSansKR-DemiLight.woff2';
6+
import NotoSansKRMediumOtf from '@/assets/fonts/NotoSansKR-Medium.otf';
7+
import NotoSansKRMediumWoff from '@/assets/fonts/NotoSansKR-Medium.woff';
8+
import NotoSansKRMediumWoff2 from '@/assets/fonts/NotoSansKR-Medium.woff2';
9+
10+
export default createGlobalStyle`
11+
@font-face {
12+
font-family: "Noto Sans KR";
13+
font-weight: 400;
14+
font-style: normal;
15+
src: url(${NotoSansKRDemiLightOtf}) format('otf'),
16+
url(${NotoSansKRDemiLightWoff}) format('woff'),
17+
url(${NotoSansKRDemiLightWoff2}) format('woff2');
18+
}
19+
@font-face {
20+
font-family: "Noto Sans KR";
21+
font-weight: 500;
22+
font-style: normal;
23+
src: url(${NotoSansKRMediumOtf}) format('otf'),
24+
url(${NotoSansKRMediumWoff}) format('woff'),
25+
url(${NotoSansKRMediumWoff2}) format('woff2');
26+
}
27+
html, body, div, span, applet, object, iframe,
28+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
29+
a, abbr, acronym, address, big, cite, code,
30+
del, dfn, em, img, ins, kbd, q, s, samp,
31+
small, strike, strong, sub, sup, tt, var,
32+
b, u, i, center,
33+
dl, dt, dd, ol, ul, li,
34+
fieldset, form, label, legend,
35+
table, caption, tbody, tfoot, thead, tr, th, td,
36+
article, aside, canvas, details, embed,
37+
figure, figcaption, footer, header, hgroup,
38+
menu, nav, output, ruby, section, summary,
39+
time, mark, audio, video, button {
40+
margin: 0;
41+
padding: 0;
42+
border: 0;
43+
font-size: inherit;
44+
vertical-align: baseline;
45+
word-break: keep-all;
46+
-webkit-font-smoothing: antialiased;
47+
font-family: "Noto Sans KR", Helvetica, Arial, sans-serif;
48+
}
49+
a {
50+
color: inherit;
51+
text-decoration: none;
52+
}
53+
ol, ul {
54+
list-style: none;
55+
}
56+
blockquote, q {
57+
quotes: none;
58+
}
59+
blockquote:before, blockquote:after,
60+
q:before, q:after {
61+
content: '';
62+
content: none;
63+
}
64+
table {
65+
border-collapse: collapse;
66+
border-spacing: 0;
67+
}
68+
body {
69+
display: flex;
70+
justify-content: center;
71+
width: 100%;
72+
min-height: 100vh;
73+
line-height: ${({ theme }) => theme.spacing(1)};
74+
background-color: ${({ theme }) => theme.color.dark};
75+
}
76+
#root {
77+
width: 100%;
78+
max-width: 414px;
79+
padding: ${({ theme }) => theme.spacing(5)} ${({ theme }) =>
80+
theme.spacing(2)};
81+
}
82+
`;

0 commit comments

Comments
 (0)