Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GGFE-145] 상점 구매페이지 #913

Merged
merged 8 commits into from
Aug 4, 2023
14 changes: 11 additions & 3 deletions components/shop/ItemCard.tsx
Copy link
Member Author

Choose a reason for hiding this comment

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

조건문으로 세일 여부 확인하여 스타일 다르게 적용되도록 수정했습니다~

Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,24 @@ export default function ItemCard({ item }: { item: Item }) {
<div className={styles.img}>
<Image src={item.imageUrl} alt={item.itemName} fill />
</div>
<div className={styles.badge}>{item.discount}%</div>
{item.discount && <div className={styles.badge}>{item.discount}%</div>}
</div>
<div className={styles.details}>
<div className={styles.itemPriceTag}>
<div className={styles.title}>
<h4>{item.itemName}</h4>
</div>
<div className={styles.priceTags}>
<h5 className={styles.originalPrice}>${item.price}</h5>
<h5 className={styles.discountedPrice}>${item.salePrice}</h5>
<h5
className={
item.discount ? styles.onDiscount : styles.originalPrice
}
>
${item.price}
</h5>
{item.discount !== 0 && (
<h5 className={styles.discountedPrice}>${item.salePrice}</h5>
)}
</div>
</div>
<div className={styles.content}>
Expand Down
4 changes: 2 additions & 2 deletions pages/api/pingpong/items/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function handler(
content: '확성기 설명',
imageUrl: '/image/fallBackSrc.jpeg',
price: 2000,
discount: 20,
salePrice: 1600,
discount: 0,
salePrice: 2000,
},
{
itemId: 3,
Expand Down
6 changes: 6 additions & 0 deletions styles/store/ItemCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
}
.priceTags {
.originalPrice {
font-size: 1rem;
padding: 0;
margin: 0;
}

.onDiscount {
text-decoration: line-through 2px solid #666666;
padding: 0;
margin: 0;
Expand Down