Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 14 additions & 23 deletions src/app/(header-only)/cart/page.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
"use client";

import CartToast from "@/features/menu/components/toast/CartToast";
import { useState } from "react";
import EmptyCartView from "@/features/cart/components/view/EmptyCartView";
import CartMenuCard from "@/features/cart/components/card/CartMenuCard";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

사용되지 않는 import를 제거하세요.

CartMenuCard가 import되었지만 실제로 사용되지 않습니다. 주석 처리된 코드에서만 참조되고 있어 불필요한 import입니다.

🧹 제안된 수정 사항
 import EmptyCartView from "@/features/cart/components/view/EmptyCartView";
-import CartMenuCard from "@/features/cart/components/card/CartMenuCard";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import CartMenuCard from "@/features/cart/components/card/CartMenuCard";
import EmptyCartView from "@/features/cart/components/view/EmptyCartView";
🤖 Prompt for AI Agents
In `@src/app/`(header-only)/cart/page.tsx at line 2, Remove the unused import
CartMenuCard from the top of page.tsx since it is only referenced in commented
code; either delete the import line referencing CartMenuCard or restore the
components that use it (e.g., uncomment the Card usage) so the import becomes
actually used.


export default function CartPage() {
const [toastVisible, setToastVisible] = useState<boolean>(false);

const handleClick = (): void => {
setToastVisible(true);
setTimeout(() => setToastVisible(false), 1500);
}
return (
<div className="w-full">
장바구니 페이지
<button
type="button"
onClick={handleClick}
>
토스트
</button>
<CartToast
visible={toastVisible}
message="장바구니에 쏙 담았어요!"
/>
</div>
// <>
// <CartMenuCard menuId={1}
// imageSrc="/tmp/menu/menu-1.png"
// title="김치제육 덮밥"
// price={6000} />
// <CartMenuCard menuId={1}
// imageSrc="/tmp/menu/menu-1.png"
// title="김치제육 덮밥"
// rank={1}
// price={6000} />
// </>
<EmptyCartView/>
);
}
1 change: 1 addition & 0 deletions src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export { default as JingwanEnableIcon } from "./jingwan-enable.svg";
export { default as MinusIcon } from "./minus.svg";
export { default as MyDisableIcon } from "./my-disable.svg";
export { default as MyEnableIcon } from "./my-enable.svg";
export { default as PleadingFaceIcon } from "./pleading-face.svg";
export { default as PlusIcon } from "./plus.svg";
export { default as PlusDisableIcon } from "./plus-disable.svg";
export { default as ShoppingBagIcon } from "./shopping-bag.svg";
Expand Down
12 changes: 12 additions & 0 deletions src/assets/icons/pleading-face.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
justify-content: center;
align-content: center;

width: 5.125rem;
height: 1.75rem;

padding-block: 0.44rem;
padding-inline: 0.5rem;

Expand All @@ -15,6 +18,7 @@
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}

.label {
Expand Down
55 changes: 55 additions & 0 deletions src/features/cart/components/card/CartMenuCard.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.container {
display: flex;
position: relative;
gap: 1rem;

border: 1px solid black;

width: 100%;

background-color: var(--color-white);
}

.imageWrapper {
position: relative;
width: 5.125rem;
height: 5.125rem;
border-radius: 0.5rem;
overflow: hidden;
}

.image {
object-fit: cover;
}

.labelWrapper {
display: flex;
flex-direction: column;
gap: 0.5rem;

padding-top: 0.25rem;
}

.title {
color: var(--color-black);
font-size: var(--text-base);
font-style: normal;
font-weight: var(--font-semibold);
line-height: var(--line-height-single);
letter-spacing: var(--letter-spacing);
}

.price {
color: var(--color-black);
font-size: var(--text-sm);
font-style: normal;
font-weight: var(--font-medium);
line-height: var(--line-height-single);
letter-spacing: var(--letter-spacing);
}

.stepperWrapper {
position: absolute;
right: 0;
bottom: 0;
}
61 changes: 61 additions & 0 deletions src/features/cart/components/card/CartMenuCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use client";

import styles from "./CartMenuCard.module.css";
import Image from "next/image";
import PopularTag from "@/features/menu/components/tags/PopularTag";
import { formatNumberWithComma } from "@/shared/utils/number/utils";
import QuantityStepper from "@/features/cart/components/button/QuantityStepper";

type Rank = 1 | 2 | 3;

interface CartMenuCardProps {
menuId: number;
imageSrc: string;
title: string;
price: number;
quantity: number;
rank?: Rank;
onClickAdd?: (menuId: number) => void;
}

export default function CartMenuCard({
menuId,
imageSrc,
title,
price,
quantity,
rank,
}: CartMenuCardProps) {

const hasTag = typeof rank !== "undefined";

return (
<div className={styles.container}>
<div className={styles.imageWrapper}>
<Image
src={imageSrc}
alt={"메뉴사진"}
fill
className={styles.image}
/>
</div>

<div className={styles.labelWrapper}>
{hasTag && <PopularTag rank={rank} />}
<div className={styles.title}>
{title}
</div>
<div className={styles.price}>
{formatNumberWithComma(price)}원
</div>
</div>

<div className={styles.stepperWrapper}>
<QuantityStepper
menuId={menuId}
quantity={quantity}
/>
</div>
</div>
);
}
88 changes: 88 additions & 0 deletions src/features/cart/components/view/EmptyCartView.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

width: 100%;
min-height: calc(100vh - var(--top-header-height));
}

.titleWrapper {
display: flex;
align-items: center;
gap: 0.25rem;

margin-bottom: 0.75rem;
}

.title {
color: var(--color-black);
font-family: var(--font-display);
font-size: var(--text-lg);
font-style: normal;
font-weight: var(--font-normal);
line-height: var(--line-height-single);
letter-spacing: -0.00363rem;
}

.subTitle {
color: var(--color-gray-600);
text-align: center;

font-size: var(--text-sm);
font-style: normal;
font-weight: var(--font-medium);
line-height: var(--line-height-single);
letter-spacing: -0.00281rem;

margin-bottom: 1.5rem;
}

.buttonWrapper {
display: flex;
gap: 0.5rem;
}

.homeButton {
display: flex;
justify-content: center;
align-items: center;

border-radius: 0.75rem;
border: 1px solid var(--color-main-500);
background-color: var(--color-main-100);

padding: 1rem 1.5rem;
}

.homeButtonLabel {
color: var(--color-main);

font-size: var(--text-base);
font-style: normal;
font-weight: var(--font-semibold);
line-height: var(--line-height-single);
letter-spacing: -0.00319rem;
}

.menuButton {
display: flex;
justify-content: center;
align-items: center;

border-radius: 0.75rem;
background-color: var(--color-main);

padding: 1rem 1.6rem;
}

.menuButtonLabel {
color: var(--color-white);

font-size: var(--text-base);
font-style: normal;
font-weight: var(--font-semibold);
line-height: var(--line-height-single);
letter-spacing: -0.00319rem;
}
38 changes: 38 additions & 0 deletions src/features/cart/components/view/EmptyCartView.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import styles from "./EmptyCartView.module.css";
import { PleadingFaceIcon } from "@/assets/icons";
import Link from "next/link";

export default function EmptyCartView() {
return (
<div className={styles.container}>
<div className={styles.titleWrapper}>
<div className={styles.title}>
아무것도 없어요
</div>
<PleadingFaceIcon />
</div>
<div className={styles.subTitle}>
메뉴를 둘러 보고, 먹고 싶은 메뉴를 바로 담아봐요
</div>


<div className={styles.buttonWrapper}>
<Link href="/">
<div className={styles.homeButton}>
<div className={styles.homeButtonLabel}>
인기 순위 보기
</div>
</div>
</Link>

<Link href="/hakgwan">
<div className={styles.menuButton}>
<div className={styles.menuButtonLabel}>
메뉴 둘러보기
</div>
</div>
</Link>
</div>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@

.labelActive {
color: var(--color-white);
font-weight: var(--font-extrabold);
font-weight: var(--font-bold);
}
2 changes: 1 addition & 1 deletion src/features/menu/components/list/MenuList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from "./MenuList.module.css";
import MenuCard from "@/features/menu/components/card/MenuCard";
import SeparationBar from "@/features/menu/components/bar/SeparationBar";
import SeparationBar from "@/shared/components/bar/SeparationBar";
import React from "react";
import { MenuItem } from "@/features/menu/types/menuType";

Expand Down
5 changes: 4 additions & 1 deletion src/shared/components/header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ShoppingBagIcon } from "@/assets/icons";
import styles from "./Header.module.css";
import Link from "next/link";

export default function Header() {
return (
Expand All @@ -8,7 +9,9 @@ export default function Header() {
<div className={styles.logo}>
LOGO
</div>
<ShoppingBagIcon />
<Link href="/cart">
<ShoppingBagIcon />
</Link>
</div>
</div>
);
Expand Down