Repository navigation
Replies: 1 comment
Theme Provider란?css 관련된 정보를 전역으로 관리합니다. 기존에 constant로 관리했던 변수 값을 사용법import { ThemeProvider } from "styled-components";
const theme = {
primaryColor: "#f8049c",
secondaryColor: " #fdd54f",
};
function App() {
return (
<ThemeProvider theme={theme}>
<GlobalStyle />
<BrowserRouter>
<Switch>
<Route path="/login">
<LogIn />
</Route>
<Route path="/">
<Home />
</Route>
</Switch>
</BrowserRouter>
</ThemeProvider>
);
}const HeaderWrapper = styled.header`
box-sizing: border-box;
display: flex;
height: 60px;
width: 100%;
padding: 0 16px;
position: fixed;
top: 0;
background-image: linear-gradient(
to right,
${(props) => props.theme.primaryColor},
${(props) => props.theme.secondaryColor}
);
border-bottom: 3px solid #fdd54f;
`; |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
theme provider 란?
styled-component theme provider
All reactions