11import { cn } from "@/utils/cn" ;
22import { formatTimeRange } from "@/utils/datetime" ;
3- import IconLocation from "@/assets/icon/location.svg?react" ;
4- import IconTime from "@/assets/icon/time.svg?react" ;
5- import IconArrow from "@/assets/icon/arrow-up.svg?react" ;
6-
7- const getPayRateText = ( hourlyPay ?: number , originalPay ?: number ) : string => {
8- if ( hourlyPay === undefined || originalPay === undefined ) {
9- return "" ;
10- }
11-
12- const rawRate = ( ( hourlyPay - originalPay ) / originalPay ) * 100 ;
13- const displayRate = Math . min ( Math . round ( rawRate ) , 100 ) ;
14- return `기존 시급보다 ${ displayRate } %` ;
15- } ;
3+ import { getPayRateText } from "@/utils/payRate" ;
4+ import { Location , Time , ArrowUp } from "@/assets/icon" ;
165
176interface PostCardProps {
187 name : string ;
@@ -25,7 +14,7 @@ interface PostCardProps {
2514 workhour ?: number ;
2615 isShopInfo ?: boolean ;
2716 backgroundColor ?: string ;
28- children ?: React . ReactNode ;
17+ buttons ?: React . ReactNode ;
2918}
3019
3120export default function PostCard ( {
@@ -39,9 +28,9 @@ export default function PostCard({
3928 workhour,
4029 isShopInfo = false ,
4130 backgroundColor = "#ffffff" ,
42- children = null ,
31+ buttons = null ,
4332} : PostCardProps ) {
44- const rateText = getPayRateText ( hourlyPay , originalHourlyPay ) ;
33+ const { rateText } = getPayRateText ( hourlyPay , originalHourlyPay ) ;
4534
4635 const timeRange =
4736 startsAt && workhour !== undefined
@@ -75,12 +64,12 @@ export default function PostCard({
7564 </ h2 >
7665 < span className = "inline-flex items-center gap-[2px] rounded-[20px] bg-primary px-3 py-1 text-[12px] font-normal leading-[16px] text-white md:body2-bold" >
7766 { rateText }
78- < IconArrow className = "w-4 h-4 md:w-5 md:h-5" />
67+ < ArrowUp className = "w-4 h-4 md:w-5 md:h-5" />
7968 </ span >
8069 </ div >
8170 </ div >
8271 < div className = "flex items-center gap-[6px] text-gray-50 body2-regular md:body1-regular" >
83- < IconTime className = "w-4 h-4 md:w-5 md:h-5" />
72+ < Time className = "w-4 h-4 md:w-5 md:h-5" />
8473 { timeRange }
8574 </ div >
8675 </ >
@@ -89,14 +78,14 @@ export default function PostCard({
8978 ) }
9079 { isShopInfo && < h2 className = "text-[28px] font-bold" > { name } </ h2 > }
9180 < div className = "flex items-center gap-[6px] text-gray-50 body2-regular md:body1-regular" >
92- < IconLocation className = "w-4 h-4 md:w-5 md:h-5" />
81+ < Location className = "w-4 h-4 md:w-5 md:h-5" />
9382 { address1 }
9483 </ div >
9584 < p className = "text-black body2-regular md:body1-regular" >
9685 { description }
9786 </ p >
9887 </ div >
99- { children && < div className = "flex gap-2 mt-3" > { children } </ div > }
88+ { buttons && < div className = "flex gap-2 mt-3" > { buttons } </ div > }
10089 </ div >
10190 </ article >
10291 ) ;
0 commit comments