[TIL/React] 2023/08/18
CardComponent ๐ src/components/common/ProductCard.jssrc/data/ProductList.jssrc/pages/Home.jsproduct list์ ๋ํ ๋ฐ์ดํฐ ๊ตฌ์กฐ๋ฅผ ์ก๊ณ , ์นด๋ ์ปดํฌ๋ํธ์ map์ ํตํด ์ ์ฉํ ๋ค, home
CardComponent ๐
1. src/components/common/ProductCard.js
import React from "react";
import { styled } from "styled-components";
import ComponentWrapper from "./ComponentWrapper";
import { products } from "../../data/ProductList";
const ProductWrapper = styled.div`
width: calc(33.3% - 40px);
margin: 10px;
`;
const ProductImgWrapper = styled.div`
background-color: rgb(249, 247, 248);
width: 100%;
height: 400px;
border: none;
display: flex;
align-items: center;
justify-content: center;
border-radius: 16px;
box-shadow: 0px 10px 8px #999;
`;
const ProductImage = styled.img`
width: 100%;
height: auto;
`;
const ProductInfoTitle = styled.p`
font-weight: bolder;
font-size: 25px;
`;
const ProductInfoEtc = styled.p`
color: #9b9b9b;
font-weight: bolder;
`;
const ProductCard = () => {
return (
<ComponentWrapper style={{ display: "flex", flexWrap: "wrap" }}>
{products?.map((product) => (
<ProductWrapper key={product?.id}>
<ProductImgWrapper>
<ProductImage src={product?.image} />
</ProductImgWrapper>
<div>
<ProductInfoTitle>{product?.title}</ProductInfoTitle>
<ProductInfoEtc>
{product?.price} / {product?.weight}
</ProductInfoEtc>
</div>
</ProductWrapper>
))}
</ComponentWrapper>
);
};
export default ProductCard;
2. src/data/ProductList.js
import {
porkImg,
chickenImg,
porkcutletImg,
eggImg,
milkImg,
hanuroundImg,
carthegardenImg,
} from "../images";
export const products = [
{
id: "1",
image: porkImg,
title: "์ด์ ์ ๋ผ์ง ์ผ๊ฒน์ด ๊ตฌ์ด์ฉ",
price: "๊ธฐ์ค๊ฐ 19,800์",
weight: "600g",
},
{
id: "2",
image: chickenImg,
title: "์ด์ ์ ๋ญ๋ณถ์ํ",
price: "๊ธฐ์ค๊ฐ 7,800์",
weight: "950g",
},
{
id: "3",
image: porkcutletImg,
title: "์ด์ ์ ๋ฑ์ฌ ๋๊น์ค",
price: "๊ธฐ์ค๊ฐ 12,500์",
weight: "770g",
},
{
id: "4",
image: eggImg,
title: "์ด์ ์ ๋๋ฌผ๋ณต์ง ๋ฌดํญ์์ ์ ์ ๋",
price: "๊ธฐ์ค๊ฐ 6,900์",
weight: "12๊ตฌ",
},
{
id: "5",
image: milkImg,
title: "์ด์ ์ ๋ฌดํญ์์ ์ฐ์ ",
price: "๊ธฐ์ค๊ฐ 3,600์",
weight: "900ml",
},
{
id: "6",
image: hanuroundImg,
title: "์ด์ ์ ์ด์ ์์ฉ ํ์ฐ ์ฐ๋ ๋ค์ง์ก",
price: "๊ธฐ์ค๊ฐ 17,100์",
weight: "180g",
},
{
id: "7",
image: carthegardenImg,
title: "๋๊ฐ๊ฑฐ๋ ๋",
price: "๊ธฐ์ค๊ฐ 39,800์",
weight: "980g",
},
];
3. src/pages/Home.js
import React from "react";
import { backgroundImg } from "../images";
import ComponentWrapper from "../components/common/ComponentWrapper";
import TestComponent from "../components/common/TestComponent";
import ProductCard from "../components/common/ProductCard";
const Home = () => {
return (
<>
<div style={{ backgroundColor: "white", height: "1000px" }}>
<img src={backgroundImg} style={{ width: "100%", height: "100%" }} />
</div>
<div
style={{
backgroundColor: "white",
height: "1000px",
overflowX: "auto",
}}
>
<ProductCard />
</div>
<div style={{ backgroundColor: "gray", height: "1000px" }}></div>
<div style={{ backgroundColor: "white", height: "1000px" }}></div>
</>
);
};
export default Home;
product list์ ๋ํ ๋ฐ์ดํฐ ๊ตฌ์กฐ๋ฅผ ์ก๊ณ , ์นด๋ ์ปดํฌ๋ํธ์ map์ ํตํด ์ ์ฉํ ๋ค, home page์์ ํด๋น ์ปดํฌ๋ํธ๋ฅผ ๋ ๋๋งํ๋ ๊ตฌ์กฐ์ด๋ค.
4. ํ์ฌ

์ฝ๋๋ ์กฐ์กํ๋ ๋์์ธ์ ๋ง์์ ๋ ๋ค.
More to read
Amazon VPC Architecture ์ดํดํ๊ธฐ
์๋ก์ด ํ๋ก์ ํธ๋ฅผ ๊ธฐํํ๋ฉฐ, ๊ฐ๋ฐ์์ ๋ฌด์์ ๊ฐ์ฅ ๋จผ์ ๊ณ ๋ฏผํด์ผ ํ๋์ง ๋ค์ ๋์๋ณด๊ฒ ๋์์ต๋๋ค.ํ๋๋ ํ๋ก ํธ์๋๊ฐ ๋ชจ๋ ์ค๊ณ์ ์ถ๋ฐ์ ์ด๋ผ๊ณ ๋ฏฟ์์ต๋๋ค. ์ ์ ๊ฐ ๋ฌด์์ ๋ณด๊ณ , ์ด๋ค ํ๋ฆ์์ ๋จธ๋ฌด๋ฅด๊ณ ์ดํํ๋์ง์ ๋ํ ์ดํด ์์ด ์๋น์ค๋ฅผ ๋ง๋ ๋ค๋ ๊ฑด ๋ถ๊ฐ๋ฅํ๋ค๊ณ ์๊ฐํ๊ธฐ
'์์ฌ์ดํธ'ํ๋ก ํธ์๋ ๊ด์ ์ผ๋ก ์๊ณ ๋ฆฌ์ฆ ์ดํดํ๊ธฐ
์ค๋๋ง์ ๋ฐฉ๋ฒ๋ก ์ ๊ดํ ๊ธ์ ์ฐ๊ฒ ๋์์ต๋๋ค. ์ต๊ทผ ์ํฉ์ ์ด๋ ์ต๋๋ค. SSAFY์์๋ ํ๋ฃจ์ ์์ฒญ๋ ์์ ์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ ๋ค์ ๊ณผ์ ๋ก ์ํํ๊ฒ ๋ฉ๋๋ค. ๊ทธ ๊ณผ์ ์์, '๊ตฌํ๋ ฅ'์ด ๋งค์ฐ ๋จ์ด์ง๋ค๋ ์๊ฐ์ด ๋ค์์ต๋๋ค. ์์ ํ ์ด๋ ค์ด ๋ฌธ์ ๋ผ๋ฉด '์์ฌ์'์ด๋ผ๋ ๊ฐ์ ์กฐ์ฐจ ๋๋ผ์ง
SubnetVPC ์ค๊ณ์ ์์: IP์ Subnet
๋ฐ๋ณต๋๋ ๋ฃจํด ์์์ ์ป์ ์์ ๊ฐ์ ๋ฐํ ์ผ์, ์ด์ ๋ ๊ธฐ์ ์ ์คํํธ๋ผ์ ๋ํ๊ธฐ ์ํ ๊ฐ์ธ ํ๋ก์ ํธ์ ์ฐฉ์ํ๊ณ ์ ํฉ๋๋ค.์ด๋ฒ ํ๋ก์ ํธ์ ๋ชฉํ๋ ๋จ์ํ ํฌํธํด๋ฆฌ์ค ๊ตฌ์ถ์ ๋์ด, ์ค์ ์๋น์ค ์์ค์ ๋ธ๋ก๊ทธ ์์คํ ๊ตฌํ๊ณผ ๋ค๊ตญ์ด ์ฒ๋ฆฌ ์ ์ฉ ๋ฑ ์ค๋ฌด์ ๊ฐ๊น์ด ์ญ๋์ ํ ๋จ๊ณ