https://github.com/mui-org/material-ui/tree/v1-beta/examples/create-react-app-with-typescript์ ๋ด ์ฑ์ ๊ธฐ๋ฐ์ผ๋กํ์ต๋๋ค.
๋งค์ฐ ๊ธฐ๋ณธ์ ์ธ navbar๋ฅผ ํฌํจํ๋ ค๊ณ ํฉ๋๋ค.
const styles: StyleRulesCallback<'root'> = theme => ({
root: {
textAlign: 'center',
paddingTop: theme.spacing.unit * 20,
},
});
class App extends React.Component<WithStyles<'root'>, {}> {
render() {
return (
<div className={this.props.classes.root}>
<AppBar>
<Toolbar>
<Typography variant="title" color="inherit">
Title
</Typography>
</Toolbar>
</AppBar>
</div>
);
}
}
export default withRoot(withStyles(styles)<{}>(App));
๋จธํฐ๋ฆฌ์ผ UI ์ปดํฌ๋ํธ์ ๋ชจ๋ ๊ธ๊ผด์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค. ๋ฒํผ, ์ ํ, ์คํ.
์๋ฅผ ๋ค์ด ๋ค์๊ณผ ๊ฐ์ ์ด์ ๊ฐ ์์ต๋๋ค.
https://material-ui-next.com/demos/app-bar/ ๋์
๊ธ๊ผด์ด ์ ๊ทธ๋ ๊ฒ ์์๊ฐ์?
Typography๋ก ๋ ๋๋ง ๋ h2
์์์๋ 1.3125rem
๋ณํ์ ๋ํด ์ฌ๋ฐ๋ฅธ font-size
์ ์ฉ๋ฉ๋๋ค.
๊ธ๊ผด ํฌ๊ธฐ์ ๋จ์๋ก rem
๋ ๊ธฐ๋ณธ ๊ธฐ๋ณธ ๊ธ๊ผด ํฌ๊ธฐ์ ๋ฐฐ์์ด๋ฉฐ ์ผ๋ฐ์ ์ผ๋ก html
์์์ ๋ํด ์ ์๋ฉ๋๋ค. ๋ฌธ์๋ฅผ ๊ฒ์ฌํ์ญ์์ค. html
์์์ ์ ์ ๋ ๊ธ๊ผด ํฌ๊ธฐ๊ฐ ์์ต๋๊น?
์ด๊ฒ์ codesandbox ์์ ์ฌํ ํ ์ ์์ต๋๊น?
์ ์ณ๋๊ณ , ์ด๋ฌํ ์ ํ์ ๊ฒ์ StackOverflow์ ์๋ฒฝํฉ๋๋ค. ์ง๋ฌธ์ ๊ฒ์ํ๋ฉด ๋์์๋ฐ์ ์ ์์ต๋๋ค. ํ๋์ ์ธ ์ปค๋ฎค๋ํฐ ํ์์ด ๋ง์ด ์์ต๋๋ค. ๋ฌธ์ ๋ ์ง์ ์ง๋ฌธ๊ณผ ๋ค๋ฆ ๋๋ค.
๋ ๋ง์ ์ ๋ณด๋ฅผ ๊ธฐ๋ค๋ฆฌ ๊ฒ ์ง๋ง ์ฒ์์๋ ๋จธํฐ๋ฆฌ์ผ UI์ ๋ฌธ์ ๊ฐ๋์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ฌ๋๋ค์ ๋ค์ ์คํ์ผ์ ์ค์ ํ์ฌ์ด ์ ๊ทผ์ฑ ๋์์ ๋นํ์ฑํ ํ ์ ์์ต๋๋ค.
html {
font-size: 16px;
}
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ฌ๋๋ค์ ๋ค์ ์คํ์ผ์ ์ค์ ํ์ฌ์ด ์ ๊ทผ์ฑ ๋์์ ๋นํ์ฑํ ํ ์ ์์ต๋๋ค.