global 초기세팅
import { createGlobalStyle } from 'styled-components'
export const GlobalStyle = createGlobalStyle`
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
height: 100vh;
max-width: 100%;
font-size: 62.5%;
background-color: ${props => props.theme.bgColor};
color: ${props => props.theme.color};
font-family: ${props => props.theme.fontFamily};
}
`
App.js
import { GlobalStyle } from './components/Global'
const App = () => {
return (
<ThemeProvider theme={theme}>
<>
<GlobalStyle />
<Header>Hello React</Header>
{theme.type === 'light' && <MoonIcon onClick= {setDarkTheme} />}
{theme.type === 'dark' && <SunIcon onClick={setLightTheme} />}
</>
</ThemeProvider>
)
}
`