-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from wafflestudio/branch67
- Loading branch information
Showing
8 changed files
with
508 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
//import peopleIcon from '../assets/people-gray.svg'; | ||
import heartIcon from '../assets/heart_filled_gray.svg'; | ||
import placeHolder from '../assets/placeholder_gray.png'; | ||
import styles from '../css/ParticipatingAuctionItem.module.css'; | ||
import type { PreviewAuctionItem } from '../typings/auctionitem'; | ||
import { calculateTimeLeft } from '../utils/utils'; | ||
|
||
type ItemProps = { | ||
ItemInfo: PreviewAuctionItem; | ||
}; | ||
|
||
const ParticipatingAuctionItem = ({ ItemInfo }: ItemProps) => { | ||
const [timeLeft, setTimeLeft] = useState(''); | ||
const [isHighestBidder, setIsHighestBidder] = useState(true); | ||
|
||
useEffect(() => { | ||
const interval = calculateTimeLeft(ItemInfo.endTime, setTimeLeft); | ||
setIsHighestBidder(true); | ||
|
||
return () => { | ||
clearInterval(interval); | ||
}; | ||
}, [ItemInfo.endTime]); | ||
|
||
return ( | ||
<NavLink to={`/auctions/${ItemInfo.id}`} className={styles.navLink}> | ||
<div className={styles.main}> | ||
<div className={styles.upperBox}> | ||
<img | ||
src={ | ||
ItemInfo.imagePresignedUrl === '' | ||
? placeHolder | ||
: ItemInfo.imagePresignedUrl | ||
} | ||
className={styles.image} | ||
/> | ||
<div className={styles.contentBox}> | ||
<div className={styles.textBox}> | ||
<p className={styles.itemName}>{ItemInfo.title}</p> | ||
<p | ||
className={styles.itemInfo} | ||
>{`${ItemInfo.location} · ${timeLeft}`}</p> | ||
<p className={styles.initPrice}> | ||
{`시작가: ${Intl.NumberFormat('ko-KR').format(ItemInfo.startingPrice)}원`} | ||
</p> | ||
<p className={styles.presentPrice}> | ||
{`현재 입찰가: ${Intl.NumberFormat('ko-KR').format(ItemInfo.currentPrice)}원`} | ||
</p> | ||
</div> | ||
<div className={styles.subBox}> | ||
<div className={styles.iconBox}> | ||
{ItemInfo.likeCount > 0 && ( | ||
<div className={styles.iconBox}> | ||
<img src={heartIcon} className={styles.smallIcon} /> | ||
{ItemInfo.likeCount} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
<div className={styles.actionContainer}> | ||
{timeLeft !== '경매 종료' ? ( | ||
isHighestBidder ? ( | ||
<span className={styles.statusText}>현재 상위 입찰</span> | ||
) : ( | ||
<span className={styles.statusText}>더 높은 입찰 존재</span> | ||
) | ||
) : isHighestBidder ? ( | ||
<div className={styles.successContainer}> | ||
<span className={styles.successText}>낙찰 성공!</span> | ||
<button className={styles.chatButton}>채팅하기</button> | ||
</div> | ||
) : ( | ||
<span className={styles.failureText}>낙찰 실패</span> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</NavLink> | ||
); | ||
}; | ||
|
||
export default ParticipatingAuctionItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
.navLink { | ||
display: flex; | ||
padding: 15px 15px 0; | ||
width: 100vw; | ||
text-decoration: none; | ||
} | ||
|
||
.main { | ||
display: flex; | ||
flex-direction: column; | ||
flex: 1; | ||
gap: 15px; | ||
padding-bottom: 15px; | ||
border-bottom: 1px solid var(--daangn-lightgray); | ||
text-decoration: none; | ||
} | ||
|
||
.upperBox { | ||
display: flex; | ||
flex: 1; | ||
gap: 15px; | ||
} | ||
|
||
.image { | ||
width: 120px; | ||
height: 120px; | ||
border-radius: 5px; | ||
border: 0.5px solid var(--daangn-lightgray); | ||
} | ||
|
||
.contentBox { | ||
display: flex; | ||
flex: 1; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
} | ||
|
||
.itemName { | ||
font-size: 18px; | ||
color: black; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
word-break: break-word; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 2; | ||
line-clamp: 2; | ||
-webkit-box-orient: vertical; | ||
} | ||
|
||
.itemInfo { | ||
color: var(--daangn-gray); | ||
} | ||
|
||
.itemStatus { | ||
padding: 5px; | ||
font-size: 13px; | ||
background-color: #444444; | ||
border-radius: 2px; | ||
color: white; | ||
} | ||
|
||
.initPrice { | ||
display: flex; | ||
align-items: center; | ||
gap: 5px; | ||
font-size: 12px; | ||
color: #444444; | ||
} | ||
|
||
.presentPrice { | ||
display: flex; | ||
align-items: center; | ||
gap: 5px; | ||
font-size: 18px; | ||
font-weight: bold; | ||
color: black; | ||
} | ||
|
||
.subBox { | ||
display: flex; | ||
justify-content: right; | ||
gap: 3px; | ||
} | ||
|
||
.iconBox { | ||
display: flex; | ||
gap: 3px; | ||
align-items: center; | ||
color: var(--daangn-gray); | ||
} | ||
|
||
.smallIcon { | ||
width: 18px; | ||
height: 18px; | ||
} | ||
|
||
.chatButton { | ||
background: var(--daangn-orange); | ||
border: none; | ||
border-radius: 6px; | ||
color: white; | ||
padding: 6px; | ||
margin-top: 10px; | ||
font-weight: bold; | ||
font-size: 14px; | ||
} | ||
|
||
.highestText { | ||
font-size: 14px; | ||
color: var(--daangn-orange); | ||
} | ||
|
||
.statusText { | ||
font-size: 14px; | ||
color: var(--daangn-gray); | ||
} | ||
|
||
.successText { | ||
font-size: 14px; | ||
font-weight: bold; | ||
color: var(--daangn-orange); | ||
} | ||
|
||
.failureText { | ||
font-size: 14px; | ||
font-weight: bold; | ||
color: var(--daangn-gray); | ||
} | ||
|
||
.successContainer { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.