2021. 12. 21. 23:50ใWEB Dev/ToyProject
๐ท CloneTodo โ - Todomate Clone Project | Team CloneMate
CloneTodo : ๋ง์ ์ฌ๋๋ค์ด ์ฌ๋ํ๋ ํฌ๋๋ฉ์ดํธ๋ฅผ ํด๋ก ํ์ฌ ์น ์๋น์ค๋ฅผ ๋ฐฐํฌํด๋ณด๋ ํ๋ก์ ํธ
์ค๋์ ํด๊ทผ - ํ์ํ๊ณ
- ๋ฉ์ธํ์ด์ง์์ ์ฌ์ฉํ ์ปค๋ค๋ ์ปดํฌ๋ํธ ๋ฉ์ด๋ฆฌ๋ค ๋ง๋ค๊ธฐ
๋ฅผ ํด๋ณธ๋ค.
1. ๋ฉ์ธํ์ด์ง๋ก ์ฌ์ฉํ Main.js ํ์ผ์ ๋ง๋ ๋ค.
์ด์ ๋ export default๋ฅผ ๋ค์ ๋ถ์ด์ง ์๊ณ ํจ์๋ช ์์ ๋ถ์ฌ์ ํ ๋ฉ์ด๋ฆฌ๋ก ๋ณด์ด๊ฒ๋ ํ๋ ๋ฒ์ ๋ฐฐ์ ๋ค.
import React from 'react';
export default function Main () {
return (
);
}
2. App.js์์ ๋ผ์ฐํฐ ์ค์ ์ ํด์ค๋ค.
<Route exact path="/Main">
<Main />
</Route>
3. MainNavBar ์ฎ๊ธฐ๊ธฐ
path="/"์ ์๋ MainNavBar๋ฅผ ์ฎ๊ฒจ์ค๋ค. ์ ์ฒด ์ฝ๋๋ ์๋์ ๊ฐ๋ค.
import React from "react";
import "../stylesheets/App.css";
import { Button } from "@mui/material";
import { ThemeProvider, createTheme } from "@mui/material/styles";
import { Switch, Route, useHistory } from "react-router-dom";
import Signin from "./Signin";
import Join from "./Join";
import BasicNavBar from "./BasicNavBar";
import MainNavBar from "./MainNavBar";
import Main from "./Main";
const theme = createTheme({
components: {
MuiTypography: {
defaultProps: {
variantMapping: {
h1: 'h2',
h2: 'h2',
h3: 'h2',
h4: 'h2',
h5: 'h2',
h6: 'h2',
subtitle1: 'h2',
subtitle2: 'h2',
body1: 'span',
body2: 'span',
},
},
},
},
typography: {
Link: {
color: '#222',
},
bolder: {
fontWeight: 600,
},
button: {
},
},
palette: {
btn: {
main: "#f2f2f2",
contrastText: "#111",
},
basicnav: {
main: "#fefefe",
contrastText: "#111",
},
mainnav: {
main: '#FAFAFA'
},
},
});
function App() {
let history = useHistory();
return (
<ThemeProvider theme={theme}>
<Switch>
<Route exact path="/">
<div className="App">
<div className="header">
<img className="main_img" src="images/todomate.jpg" />
<h1>todo mate</h1>
<h3>ํ ์ผ์ ์์ฑ, ๊ณํ, ๊ด๋ฆฌํ์ธ์.</h3>
</div>
<div className="start_btn">
<Button
className="join_btn"
color="btn"
variant="contained"
sx={{ boxShadow: 'none'}}
onClick={() => {
history.push("/join");
}}
>
๊ฐ์
ํ๊ธฐ
</Button>
<Button
className="signin_btn"
color="btn"
variant="contained"
sx={{ boxShadow: 'none'}}
onClick={() => {
history.push("/signin");
}}
>
๋ก๊ทธ์ธ
</Button>
</div>
</div>
</Route>
<Route exact path="/Main">
<MainNavBar/>
<Main />
</Route>
<Route exact path="/join">
<BasicNavBar/>
<Join />
</Route>
<Route exact path="/signin">
<BasicNavBar/>
<Signin />
</Route>
</Switch>
</ThemeProvider>
);
}
export default App;
๋ด๊ฐ ์๊ฐํ Main.js์ ์ปดํฌ๋ํธ ๊ตฌ์กฐ๋ ์๋ ๊ทธ๋ฆผ๊ณผ ๊ฐ์๋ฐ,
์ฐ์ Nav๊ฐ ์์ฑ๋์ด ์๊ธฐ ๋๋ฌธ์ ์๋์ Content ์ปดํฌ๋ํธ ์์ Explore, UserName, Calender.js, Feed.js๋ฅผ ๋ง๋ค์ด ๋ ์ด์์์ ์ก์์ค๋ค.
4. Content.js ๋ง๋ค๊ธฐ
Content์์ ํ์ํ๊ธฐ ์ํด p ํ๊ทธ๋ก content๋ฅผ ์์ฑํ๋ค.
import React from 'react';
export default function Content() {
return (
<div className='content-wrap'>
<p>content</p>
</div>
);
}
5. Main.js ์์ Content ๋ฃ๊ธฐ
Main ๋ํ ์์ main์์ ํ์ํ๋ค.
import React from 'react';
import Content from './Content';
export default function Main() {
return (
<div className='main-wrap'>
<Content />
<p>main</p>
</div>
);
}
6. Explore.js ๋ง๋ค๊ธฐ
๋ฐฉ์์ ์์ ๊ฐ๋ค. ๋ณต๋ถํด์ ์ด๋ฆ๋ง ๋ฐ๊ฟ์ค๋ค.
import React from 'react';
export default function Explore() {
return (
<div className='explore-wrap'>
<p>explore</p>
</div>
);
}
7. Content.js ์์ Explore.js ๋ฃ๊ธฐ
import React from 'react';
import Explore from './Explore';
export default function Content() {
return (
<div className='content-wrap'>
<Explore />
<p>content</p>
</div>
);
}
8. Calendar.js ํ์ผ์ ๋ง๋ ๋ค.
Calendar์ ๊ฒฝ์ฐ Toast UI์ ์บ๋ฆฐ๋๋ฅผ ๊ฐ์ง๊ณ ์ฌ ๊ฒ์ด๋ค. ์ปดํฌ๋ํธ๋ง ์ด๊ธฐํ ํด๋๋ค.
UserName์ ๋์ค์ ์ปดํฌ๋ํธ๋ก ๋นผ์ผํ ์ง ๊ณ ๋ฏผํด๋ด์ผ๊ฒ ๋ค.. ๋๋ฌด ์๊ณ ์์ํด์... (¬_¬ )
import React from 'react';
export default function Calendar() {
return (
<div className='calendar-wrap'>
<p>calendar</p>
</div>
);
}
9. Calendar ์ปดํฌ๋ํธ๋ฅผ Content์ ๋ฃ์ด์ค๋ค.
import React from 'react';
import Calendar from './Calendar';
import Explore from './Explore';
import Feed from './Feed';
export default function Content() {
return (
<div className='content-wrap'>
<Explore />
<Calendar />
<p>content</p>
</div>
);
}
10. ๋๋ง์ Feed.js ํ์ผ์ ๋ง๋ ๋ค.
import React from 'react';
export default function Feed() {
return (
<div className='feed-wrap'>
<p>feed</p>
</div>
);
}
11. Feed ์ปดํฌ๋ํธ๋ฅผ Content ์ปดํฌ๋ํธ์ import ํ๋ค.
import React from 'react';
import Calendar from './Calendar';
import Explore from './Explore';
import Feed from './Feed';
export default function Content() {
return (
<div className='content-wrap'>
<Explore />
<Feed />
<Calendar />
<p>content</p>
</div>
);
}
๋ฉ์ธํ์ด์ง์์ ์ฌ์ฉํ ์ปดํฌ๋ํธ์ ๋ ์ด์์์ด ๋๋ ํฐ ๋ฉ์ด๋ฆฌ๋ค์ ๋ชจ๋ import ํ๋ค.
๋ด์ผ์ ๋ ์ด์์์ ์ก๊ณ ์ธ๋ถ์ ์ธ ๊ณํ์ ์ธ์์ผ๊ฒ ๋ค.
'WEB Dev > ToyProject' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ToyProject-Todomate] ํฌ๋๋ฉ์ดํธ ํด๋ก ํ๋ก์ ํธ 16 (0) | 2021.12.26 |
---|---|
[ToyProject-Todomate] ํฌ๋๋ฉ์ดํธ ํด๋ก ํ๋ก์ ํธ 15 (0) | 2021.12.22 |
[ToyProject-Todomate] ํฌ๋๋ฉ์ดํธ ํด๋ก ํ๋ก์ ํธ 13 (0) | 2021.12.19 |
[ToyProject-Todomate] ํฌ๋๋ฉ์ดํธ ํด๋ก ํ๋ก์ ํธ 12 (0) | 2021.12.19 |
[ToyProject-Todomate] ํฌ๋๋ฉ์ดํธ ํด๋ก ํ๋ก์ ํธ 11 (0) | 2021.12.19 |