[ToyProject-Todomate] ํˆฌ๋‘๋ฉ”์ดํŠธ ํด๋ก  ํ”„๋กœ์ ํŠธ 14

2021. 12. 21. 23:50ใ†WEB Dev/ToyProject

728x90


๐Ÿ”ท 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 ํ–ˆ๋‹ค.

 

๋‚ด์ผ์€ ๋ ˆ์ด์•„์›ƒ์„ ์žก๊ณ  ์„ธ๋ถ€์ ์ธ ๊ณ„ํš์„ ์„ธ์›Œ์•ผ๊ฒ ๋‹ค.

728x90