[TIL/React] 2023/10/05
λ°μν π’px(ν½μ )κ³Ό κ°μ κ³ μ λ¨μλ₯Ό μ°λ©΄ μμ κ°μ΄ μ²μ°Έν κ²°κ³Όλ₯Ό μ»μ μ μλ€. μ½λλ₯Ό μμ νλ€.μμ ν λͺ¨μ΅ π’μ½λμ λν μ€λͺ μ΄ νμνλ°, μ€λμ λμ ν νμ΄ λμ§ μλλ€. handleDirectClick ν¨μλ₯Ό ν΅ν΄, λ‘κ·ΈμΈμ΄ λμ΄ μμ§ μλ€λ©΄ logi
λ°μν π’

px(ν½μ )κ³Ό κ°μ κ³ μ λ¨μλ₯Ό μ°λ©΄ μμ κ°μ΄ μ²μ°Έν κ²°κ³Όλ₯Ό μ»μ μ μλ€. μ½λλ₯Ό μμ νλ€.
import React from "react";
import { useParams, useLocation, useNavigate } from "react-router-dom";
import styled from "@emotion/styled";
import { shoppingData } from "../data/ShoppingCategory_Pork";
import ComponentWrapper from "../components/common/ComponentWrapper";
import { useSelector } from "react-redux";
const ProductDetailPageBackgroundStyle = styled.div`
background-color: #181818;
width: 100%;
/* height: 100vh; */
`;
const AllContentWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
/* flex-grow: 1; */
/* background-color: white; */
@media (max-width: 900px) {
flex-wrap: wrap;
column-gap: 20px;
}
`;
const ProductDetailPageImgWrapper = styled.div`
/* height: 70%;
width: 50%; */
display: flex;
justify-content: center;
align-items: center;
background-color: white;
`;
const ProductImg = styled.img`
width: 80%;
height: 80%;
`;
const ProductDetailPageInfoWrapper = styled.div`
/* width: 50%;
height: 70%; */
display: flex;
flex-direction: column;
background-color: blue;
`;
const ProductDetailPageInfoDataWrapper = styled.div`
height: 30%;
`;
const InfoDataTitle = styled.p`
font-size: 30px;
color: white;
font-weight: bolder;
`;
const InfoDataEtc = styled.p`
font-size: 20px;
color: white;
font-weight: bolder;
`;
const OptionWrapper = styled.div`
display: flex;
align-items: center;
column-gap: 20px;
height: 20%;
color: white;
`;
const AmountWrapper = styled.div`
display: flex;
align-items: center;
column-gap: 20px;
height: 20%;
color: white;
`;
const ButtonWrapper = styled.div`
width: 100%;
background-color: orange;
display: flex;
height: 30%;
justify-content: space-evenly;
align-items: center;
`;
const ProductDetailPage = () => {
const navigate = useNavigate();
const { id } = useParams();
const location = useLocation();
const category = location?.state;
const check = useSelector((state) => state.auth);
console.log(check);
const handleDirectClick = () => {
if (check.isAuthenticated) {
console.log("κ²°μ νλ©΄μΌλ‘");
} else {
navigate("/login");
}
};
const MapData = shoppingData[category];
const DetailData = MapData.find((elem) => elem?.id === id);
const ImgSrc = DetailData.image;
console.log(location);
console.log(DetailData);
console.log(ImgSrc);
return (
<>
<ProductDetailPageBackgroundStyle>
{/* */}
<ComponentWrapper style={{ height: "100%" }}>
<AllContentWrapper>
{/* image area */}
<ProductDetailPageImgWrapper>
<ProductImg src={ImgSrc} />
</ProductDetailPageImgWrapper>
{/* info area */}
<ProductDetailPageInfoWrapper>
<ProductDetailPageInfoDataWrapper>
<InfoDataTitle>{DetailData?.subtitle}</InfoDataTitle>
<InfoDataEtc>
{DetailData?.price} ({DetailData?.weight})
</InfoDataEtc>
<p></p>
</ProductDetailPageInfoDataWrapper>
<OptionWrapper>
<span style={{ color: "white", fontWeight: "bolder" }}>
μ΅μ
</span>
<div style={{ border: "2px solid orange" }}>
fdsagfagfdagfdgfda
</div>
</OptionWrapper>
<AmountWrapper>
<span style={{ color: "white", fontWeight: "bolder" }}>
μλ
</span>
<div style={{ border: "2px solid orange" }}>
fdsagfagfdagfdgfda
</div>
</AmountWrapper>
<ButtonWrapper>
<button
style={{
backgroundColor: "#7f7776",
color: "white",
width: "200px",
height: "60px",
border: "none",
}}
onClick={handleDirectClick}
>
λ°λ‘ꡬ맀
</button>
<button
style={{
backgroundColor: "#c50f22",
color: "white",
width: "200px",
height: "60px",
border: "none",
}}
>
μ₯λ°κ΅¬λ
</button>
</ButtonWrapper>
</ProductDetailPageInfoWrapper>
</AllContentWrapper>
</ComponentWrapper>
</ProductDetailPageBackgroundStyle>
</>
);
};
export default ProductDetailPage;
μμ ν λͺ¨μ΅ π’


μ½λμ λν μ€λͺ μ΄ νμνλ°, μ€λμ λμ ν νμ΄ λμ§ μλλ€. handleDirectClick ν¨μλ₯Ό ν΅ν΄, λ‘κ·ΈμΈμ΄ λμ΄ μμ§ μλ€λ©΄ login pageλ‘ μ΄λνλλ‘ μ€μ νλ€.
νκ³ π’
1) μλμ μΈ λ¨μλ₯Ό μ¨μΌ λ΄λ³μ λ©΄ν μ μλ€λ μ μ κΉ¨λ¬μλ€. 2) 1λ²μ μ¬μ€ μ΄λ―Έ μκ³ μμλλ°, container λ¨μλ‘ μλ λ¨μλ₯Ό μ¨μΌ ν¨μ λ€μκΈ κΉ¨λ¬μλ€. 3) λ¬Έμ λ 2λ²μμ λλ μ μ΄ λ§λ κ²μΈμ§ μλ¬Έμ΄λ€. 4) κ·Έλλ λκ° κ΅¬μ‘°λ₯Ό μ‘μμΌλ, μ₯λ°κ΅¬λλ₯Ό μ¬μ¬ λ§λ€λλ‘ νμ.
More to read
Amazon VPC Architecture μ΄ν΄νκΈ°
μλ‘μ΄ νλ‘μ νΈλ₯Ό κΈ°ννλ©°, κ°λ°μμ 무μμ κ°μ₯ λ¨Όμ κ³ λ―Όν΄μΌ νλμ§ λ€μ λμλ³΄κ² λμμ΅λλ€.νλλ νλ‘ νΈμλκ° λͺ¨λ μ€κ³μ μΆλ°μ μ΄λΌκ³ λ―Ώμμ΅λλ€. μ μ κ° λ¬΄μμ λ³΄κ³ , μ΄λ€ νλ¦μμ 머무λ₯΄κ³ μ΄ννλμ§μ λν μ΄ν΄ μμ΄ μλΉμ€λ₯Ό λ§λ λ€λ 건 λΆκ°λ₯νλ€κ³ μκ°νκΈ°
'μμ¬μ΄νΈ'νλ‘ νΈμλ κ΄μ μΌλ‘ μκ³ λ¦¬μ¦ μ΄ν΄νκΈ°
μ€λλ§μ λ°©λ²λ‘ μ κ΄ν κΈμ μ°κ² λμμ΅λλ€. μ΅κ·Ό μν©μ μ΄λ μ΅λλ€. SSAFYμμλ ν루μ μμ²λ μμ μκ³ λ¦¬μ¦ λ¬Έμ λ€μ κ³Όμ λ‘ μννκ² λ©λλ€. κ·Έ κ³Όμ μμ, 'ꡬνλ ₯'μ΄ λ§€μ° λ¨μ΄μ§λ€λ μκ°μ΄ λ€μμ΅λλ€. μμ ν μ΄λ €μ΄ λ¬Έμ λΌλ©΄ 'μμ¬μ'μ΄λΌλ κ°μ μ‘°μ°¨ λλΌμ§
SubnetVPC μ€κ³μ μμ: IPμ Subnet
λ°λ³΅λλ λ£¨ν΄ μμμ μ»μ μμ κ°μ λ°ν μΌμ, μ΄μ λ κΈ°μ μ μ€ννΈλΌμ λνκΈ° μν κ°μΈ νλ‘μ νΈμ μ°©μνκ³ μ ν©λλ€.μ΄λ² νλ‘μ νΈμ λͺ©νλ λ¨μν ν¬νΈν΄λ¦¬μ€ ꡬμΆμ λμ΄, μ€μ μλΉμ€ μμ€μ λΈλ‘κ·Έ μμ€ν ꡬνκ³Ό λ€κ΅μ΄ μ²λ¦¬ μ μ© λ± μ€λ¬΄μ κ°κΉμ΄ μλμ ν λ¨κ³