Skip to content

Commit 8b7f13a

Browse files
committed
Extract global style to component
Extract global style to component.
1 parent acfb86d commit 8b7f13a

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

src/App.jsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,19 @@ import {
77
} from 'react-router-dom';
88

99
import styled from '@emotion/styled';
10-
import { Global, css } from '@emotion/core';
1110

11+
import GlobalStyle from './GlobalStyle';
1212
import RetrospectivesPage from './RetrospectivesPage';
1313
import WritingPage from './WritingPage';
1414

15-
const GlobalStyles = css`
16-
@font-face {
17-
font-family: 'MapoFlowerIsland';
18-
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/MapoFlowerIslandA.woff')
19-
format('woff');
20-
font-weight: normal;
21-
font-style: normal;
22-
}
23-
24-
* {
25-
font-family: 'MapoFlowerIsland';
26-
}
27-
`;
28-
2915
const Header = styled.div({
3016
margin: '5em 10em',
3117
});
3218

3319
export default function App() {
3420
return (
3521
<>
36-
<Global styles={GlobalStyles} />
22+
<GlobalStyle />
3723
<Header>
3824
<h1>
3925
<Link to="/">함께 회,고(Go) 해요.</Link>

src/GlobalStyle.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
3+
import { Global, css } from '@emotion/core';
4+
5+
const GlobalStyles = css`
6+
@font-face {
7+
font-family: 'MapoFlowerIsland';
8+
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/MapoFlowerIslandA.woff')
9+
format('woff');
10+
font-weight: normal;
11+
font-style: normal;
12+
}
13+
14+
* {
15+
font-family: 'MapoFlowerIsland';
16+
}
17+
`;
18+
19+
export default function GlobalStyle() {
20+
return <Global styles={GlobalStyles} />;
21+
}

0 commit comments

Comments
 (0)