'Coin Site Project'

[TIL/Coin Site Project] 2023/12/05

Home Page Layout โœ๏ธ PageContainer.jsx ๐ŸŸข

2023๋…„ 12์›” 5์ผ2min read

Home Page Layout โœ๏ธ

code
import React from "react";
import { Box } from "@mui/material";

import PageContainer from "../components/layout/common/PageContainer";
import ComponentWrapper from "../components/layout/common/ComponentWrapper";
import Table from "../components/home/Table";

const Home = () => {
  return (
    <>
      <PageContainer>
        <ComponentWrapper>
          <Box sx={{ height: "auto" }}>
            {/* Card Area */}
            <Box sx={{ display: "flex", columnGap: "60px", padding: "60px 0" }}>
              <Box
                sx={{
                  backgroundColor: "#0e1821",
                  width: "360px",
                  border: "none",
                  height: "200px",
                  borderRadius: "15px",
                  transition: "opacity 0.3s ease",
                  "&:hover": {
                    opacity: 0.8,
                  },
                }}
              >
                <p
                  style={{
                    textAlign: "center",
                    color: "white",
                    fontWeight: "bolder",
                  }}
                >
                  'Trending' rendering
                </p>
                <p
                  style={{
                    textAlign: "center",
                    color: "white",
                    fontWeight: "bolder",
                  }}
                >
                  ์Šค๋ฅด๋ฅต ์˜ˆ์ •
                </p>
              </Box>
              <Box
                sx={{
                  backgroundColor: "#0e1821",
                  width: "360px",
                  border: "none",
                  height: "200px",
                  borderRadius: "15px",
                  transition: "opacity 0.3s ease",
                  "&:hover": {
                    opacity: 0.8,
                  },
                }}
              >
                <p
                  style={{
                    textAlign: "center",
                    color: "white",
                    fontWeight: "bolder",
                  }}
                >
                  'News' rendering
                </p>
                <p
                  style={{
                    textAlign: "center",
                    color: "white",
                    fontWeight: "bolder",
                  }}
                >
                  ์Šค๋ฅด๋ฅต ์˜ˆ์ •
                </p>
              </Box>
              <Box
                sx={{
                  backgroundColor: "#0e1821",
                  width: "360px",
                  border: "none",
                  height: "200px",
                  borderRadius: "15px",
                  transition: "opacity 0.3s ease",
                  "&:hover": {
                    opacity: 0.8,
                  },
                }}
              >
                <p
                  style={{
                    textAlign: "center",
                    color: "white",
                    fontWeight: "bolder",
                  }}
                >
                  'Fear & Greed Index' rendering
                </p>
                <p
                  style={{
                    textAlign: "center",
                    color: "white",
                    fontWeight: "bolder",
                  }}
                >
                  ์Šค๋ฅด๋ฅต ์˜ˆ์ •
                </p>
              </Box>
            </Box>
            {/* Table Area */}
            <Table />
          </Box>
        </ComponentWrapper>
      </PageContainer>
    </>
  );
};

export default Home;

PageContainer.jsx ๐ŸŸข

Appbar์™€ Footer ์‚ฌ์ด์— ์ถ”๊ฐ€๋  Box Area์— ๊ด€ํ•œ ๋…ผ์˜์ด๋‹ค.

PageContainer๋ฅผ ํ†ตํ•ด ๋ง ๊ทธ๋Œ€๋กœ 'ํŽ˜์ด์ง€๋ฅผ ๊ฐ์Œ€ ๊ฒฝ์šฐ', ํ•ด๋‹น ํŽ˜์ด์ง€์˜ ๋‚ด์šฉ์€ Appbar์™€ Footer ์‚ฌ์ด์— ์œ„์น˜ํ•˜๊ฒŒ ๋œ๋‹ค.

์ด๋–„, ๋ณด์—ฌ์ง€๋Š” ์ตœ์†Œํ•œ์˜ ๋„“์ด์™€ ๋†’์ด๋Š” '์‚ฌ์šฉ์ž ๊ธฐ๊ธฐ์˜ view'๋งŒํผ์œผ๋กœ ์„ค์ •๋œ๋‹ค. ์ถ”๊ฐ€์ ์œผ๋กœ 'flex-grow: 1'์„ ํ†ตํ•ด ํŽ˜์ด์ง€์˜ ๋‚ด์šฉ์ด Appbar์™€ Footer ์‚ฌ์ด์— ๋ชจ๋‘ ๋‹ด์•„์ง€๋„๋ก ๋‚ด์šฉ์„ ๊ตฌ์„ฑํ–ˆ๋‹ค.

code
import Appbar from "../appbar/Appbar";
import Footer from "../footer/Footer";
import { Box } from "@mui/material";

const PageContainer = ({ children }) => {
  return (
    <>
      <Appbar />
      <Box
        sx={{
          minHeight: "100vh",
          minWidth: "100vw",
          flexGrow: 1,
          backgroundColor: "#232531",
        }}
      >
        {children}
      </Box>
      <Footer />
    </>
  );
};

export default PageContainer;

ComponentWrapper.jsx ๐ŸŸข

๊ฒฝ์šฐ์— ๋”ฐ๋ผ์„œ, page์˜ ์ „์ฒด px์„ ์ฐจ์ง€ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์ง€๋งŒ, component๋ฅผ 1200px๋กœ ์ œํ•œํ•  ํ•„์š”๋„ ์žˆ๋‹ค.

๊ฐ€๋ น 'banner'๋Š” ์ „์ฒด ํŽ˜์ด์ง€ width๋ฅผ ์ฐจ์ง€ํ•˜๋„๋ก ์„ค์ •ํ•˜๊ณ  ์‹ถ๊ณ , ๋™์‹œ์— 'page์˜ ๋‚ด์šฉ'์— ๊ด€ํ•œ ๋ถ€๋ถ„์€ 1200px์ด๋ผ๋Š” ์ผ๊ด€๋œ layout์„ ํ†ตํ•ด ๋ณด์—ฌ์ฃผ๊ณ  ์‹ถ๋‹ค๋ฉด, banner๋Š” PageContainer์— ์…‹ํŒ…ํ•˜๊ณ , ๋‚˜๋จธ์ง€ ๋‚ด์šฉ์€ ComponentWrapper๋กœ ๊ฐ์‹ธ๋ฉด ๋œ๋‹ค.

code
import React from "react";
import { Box } from "@mui/material";

const ComponentWrapper = ({ style, children }) => {
  return (
    <Box
      style={style}
      sx={{
        maxWidth: "1200px",
        margin: "0 auto",
        height: "auto",
        width: "100%",
      }}
    >
      {children}
    </Box>
  );
};

export default ComponentWrapper;

ํ˜„์žฌ ๋ชจ์Šต ๐ŸŸข

More to read

Amazon VPC

Amazon VPC Architecture ์ดํ•ดํ•˜๊ธฐ

์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ๋ฅผ ๊ธฐํšํ•˜๋ฉฐ, ๊ฐœ๋ฐœ์—์„œ ๋ฌด์—‡์„ ๊ฐ€์žฅ ๋จผ์ € ๊ณ ๋ฏผํ•ด์•ผ ํ•˜๋Š”์ง€ ๋‹ค์‹œ ๋Œ์•„๋ณด๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.ํ•œ๋•Œ๋Š” ํ”„๋ก ํŠธ์—”๋“œ๊ฐ€ ๋ชจ๋“  ์„ค๊ณ„์˜ ์ถœ๋ฐœ์ ์ด๋ผ๊ณ  ๋ฏฟ์—ˆ์Šต๋‹ˆ๋‹ค. ์œ ์ €๊ฐ€ ๋ฌด์—‡์„ ๋ณด๊ณ , ์–ด๋–ค ํ๋ฆ„์—์„œ ๋จธ๋ฌด๋ฅด๊ณ  ์ดํƒˆํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์ดํ•ด ์—†์ด ์„œ๋น„์Šค๋ฅผ ๋งŒ๋“ ๋‹ค๋Š” ๊ฑด ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๊ธฐ

'์›์‚ฌ์ดํŠธ'

ํ”„๋ก ํŠธ์—”๋“œ ๊ด€์ ์œผ๋กœ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ดํ•ดํ•˜๊ธฐ

์˜ค๋žœ๋งŒ์— ๋ฐฉ๋ฒ•๋ก ์— ๊ด€ํ•œ ๊ธ€์„ ์“ฐ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ตœ๊ทผ ์ƒํ™ฉ์€ ์ด๋ ‡์Šต๋‹ˆ๋‹ค. SSAFY์—์„œ๋Š” ํ•˜๋ฃจ์— ์—„์ฒญ๋‚œ ์–‘์˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ๋“ค์„ ๊ณผ์ œ๋กœ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ ๊ณผ์ •์—์„œ, '๊ตฌํ˜„๋ ฅ'์ด ๋งค์šฐ ๋–จ์–ด์ง„๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ์™„์ „ํžˆ ์–ด๋ ค์šด ๋ฌธ์ œ๋ผ๋ฉด '์•„์‰ฌ์›€'์ด๋ผ๋Š” ๊ฐ์ •์กฐ์ฐจ ๋А๋ผ์ง€

Subnet

VPC ์„ค๊ณ„์˜ ์‹œ์ž‘: IP์™€ Subnet

๋ฐ˜๋ณต๋˜๋Š” ๋ฃจํ‹ด ์†์—์„œ ์–ป์€ ์•ˆ์ •๊ฐ์„ ๋ฐœํŒ ์‚ผ์•„, ์ด์ œ๋Š” ๊ธฐ์ˆ ์  ์ŠคํŽ™ํŠธ๋Ÿผ์„ ๋„“ํžˆ๊ธฐ ์œ„ํ•œ ๊ฐœ์ธ ํ”„๋กœ์ ํŠธ์— ์ฐฉ์ˆ˜ํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์˜ ๋ชฉํ‘œ๋Š” ๋‹จ์ˆœํ•œ ํฌํŠธํด๋ฆฌ์˜ค ๊ตฌ์ถ•์„ ๋„˜์–ด, ์‹ค์ œ ์„œ๋น„์Šค ์ˆ˜์ค€์˜ ๋ธ”๋กœ๊ทธ ์‹œ์Šคํ…œ ๊ตฌํ˜„๊ณผ ๋‹ค๊ตญ์–ด ์ฒ˜๋ฆฌ ์ ์šฉ ๋“ฑ ์‹ค๋ฌด์— ๊ฐ€๊นŒ์šด ์—ญ๋Ÿ‰์„ ํ•œ ๋‹จ๊ณ„