Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into feature/Choco-Express#22
  • Loading branch information
Chaem03 committed Sep 22, 2024
2 parents ef8e0fe + 05363f6 commit c7cd9c6
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 15 deletions.
10 changes: 8 additions & 2 deletions src/components/NameSetting/NameSetting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const NameSetting = ({
onInputChange,
onSubmit,
onBack,
showBackBtn = true,
showNextBtn = true, // 기본적으로 다음 버튼을 활성화해놓는다.
}) => {
const handleNextClick = () => {
if (inputValue) {
Expand Down Expand Up @@ -37,8 +39,12 @@ export const NameSetting = ({
</S.Enter>
</S.FormContainer>
<S.buttonContainer>
<BackBtn onClick={handleBackClick} />
<NextBtn onClick={handleNextClick} />
{showBackBtn && (
<BackBtn onClick={handleBackClick} />
)}
{showNextBtn && (
<NextBtn onClick={handleNextClick} label="다음" />
)}
</S.buttonContainer>
</S.Wrapper>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/Button/NextBtn.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as S from "./styled";
export const NextBtn = ({ onClick }) => {
export const NextBtn = ({ onClick, label = "다음" }) => { // 다음을 기본값으로 두고 원하는대로 바꿀 수 있습니다.
return (
<S.Btn onClick={onClick}>
<div>다음</div>
<div>{label}</div>
<svg
xmlns="http://www.w3.org/2000/svg"
width="10"
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Heartbackground/styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const HEART = styled.img`
export const Logo = styled.img`
display: flex;
position: absolute;
top: 20px;
top: 5px;
`;

export const LoginLogo = styled.img`
Expand Down
3 changes: 1 addition & 2 deletions src/pages/ChocoList/ChocoList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const ChocoList = () => {
try {
const response = await instance.get(`/api/choco?page=${page}`);
console.log("API Response:", response.data);

if (response.data && response.data.message === "OK") {
if (response.data && response.data.message === "SUCCESS") {
const { chocoList, totalPage } = response.data.result;
setChocoData(chocoList);
setTotalPages(totalPage);
Expand Down
5 changes: 5 additions & 0 deletions src/pages/MyboxPage/Styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,9 @@ export const Btn_MakeBox = styled.div`
font-size: 1.0625rem; // 17px
font-style: normal;
font-weight: 600;
&:hover,
:active {
background: #f34381;
}
`;
26 changes: 18 additions & 8 deletions src/pages/MyboxSelectPage/MyboxSelectPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import HeartBackG from "../../components/common/Heartbackground/heartBackG";
import BoxSelector from "../../components/ChocoSelector/BoxSelector";

import { instance } from "../../apis/instance";
import { NextBtn } from "../../components/common/Button/NextBtn";
import { BackBtn } from "../../components/common/Button/BackBtn";

const MyboxSelectPage = () => {
const [selectedChoco, setSelectedChoco] = useState("");
Expand Down Expand Up @@ -52,14 +54,22 @@ const MyboxSelectPage = () => {
<HeartBackG />
<S.Wrapper>
{isSelectedChoco ? (
<NameSetting
coment_1={"내 초콜릿 상자의"}
coment_2={"이름을 정해주세요"}
inputValue={boxName} // 상태를 inputValue로 전달
onInputChange={handleInputChange} // 입력 값이 변경될 때 호출될 함수 전달
onSubmit={handleSubmit}
onBack={handleBack}
/>
<>
<NameSetting
coment_1={"내 초콜릿 상자의"}
coment_2={"이름을 정해주세요"}
inputValue={boxName} // 상태를 inputValue로 전달
onInputChange={handleInputChange} // 입력 값이 변경될 때 호출될 함수 전달
onSubmit={handleSubmit}
onBack={handleBack}
showNextBtn={false}
showBackBtn={false}
/>
<S.buttonContainer>
<BackBtn onClick={handleBack} />
<NextBtn onClick={handleSubmit} label="완료" />
</S.buttonContainer>
</>
) : (
<BoxSelector
coment={
Expand Down
8 changes: 8 additions & 0 deletions src/pages/MyboxSelectPage/Styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ export const Wrapper = styled.div`
export const CenterText = styled.div`
display: flex;
text-align: center;
`;

export const buttonContainer = styled.div`
display: flex;
flex-direction: row;
gap: 10px;
position: absolute;
bottom: 10px;
`;

0 comments on commit c7cd9c6

Please sign in to comment.