File tree Expand file tree Collapse file tree
features/home/components/ItemCard Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as s from './style.css' ;
2+
3+ interface Props {
4+ price : number ;
5+ deposit ?: number ;
6+ }
7+ const PriceToken = ( { price, deposit } : Props ) => {
8+ const isRental = deposit !== undefined ;
9+ return (
10+ < div className = { s . PriceItem } >
11+ < label > { isRental ? '대여' : '판매' } </ label >
12+ < p > { price . toLocaleString ( ) } 원</ p >
13+ { isRental && (
14+ < p >
15+ < label > 보증금</ label >
16+ { deposit . toLocaleString ( ) } 원
17+ </ p >
18+ ) }
19+ </ div >
20+ ) ;
21+ } ;
22+ export default PriceToken ;
Original file line number Diff line number Diff line change 1+ import { css } from '@styled-system/css' ;
2+
3+ export const PriceItem = css ( {
4+ display : 'flex' ,
5+ alignItems : 'center' ,
6+ gap : '0.375rem' ,
7+ '& > label' : {
8+ padding : '0.125rem 0.25rem' ,
9+ display : 'flex' ,
10+ alignItems : 'center' ,
11+ justifyContent : 'center' ,
12+ rounded : '0.25rem' ,
13+ bgColor : 'systemGray4' ,
14+ color : '54' ,
15+ fontSize : '0.625rem' ,
16+ fontWeight : 500 ,
17+ lineHeight : 1.4 ,
18+ letterSpacing : '-0.025rem' ,
19+ flexShrink : 0 ,
20+ } ,
21+ '& p' : {
22+ color : '100' ,
23+ fontSize : '1rem' ,
24+ fontWeight : 600 ,
25+ lineHeight : 1.4 ,
26+ letterSpacing : '-0.04rem' ,
27+ display : 'flex' ,
28+ gap : '0.375rem' ,
29+ alignItems : 'baseline' ,
30+ '& > label' : {
31+ color : '54' ,
32+ fontSize : '0.875rem' ,
33+ fontWeight : 500 ,
34+ letterSpacing : '-0.035rem' ,
35+ } ,
36+ } ,
37+ } ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as s from './style.css';
44
55import type { ItemInterface } from '@/features/home/types' ;
66import ItemTokenList from '@/common/components/ItemTokenList' ;
7+ import PriceToken from '@/features/home/components/ItemCard/PriceToken' ;
78
89interface Props {
910 data : ItemInterface ;
@@ -19,22 +20,8 @@ const ItemCard = ({ data }: Props) => {
1920 < div className = { s . Header } >
2021 < h2 className = { s . Title } > { data . title } </ h2 >
2122 < div className = { s . Price } >
22- { isRental && (
23- < div className = { s . PriceItem } >
24- < label > 대여</ label >
25- < p > { data . rentalFee . toLocaleString ( ) } 원</ p >
26- < p >
27- < label > 보증금</ label >
28- { data . deposit . toLocaleString ( ) } 원
29- </ p >
30- </ div >
31- ) }
32- { isSale && (
33- < div className = { s . PriceItem } >
34- < label > 판매</ label >
35- < p > { data . salePrice . toLocaleString ( ) } 원</ p >
36- </ div >
37- ) }
23+ { isRental && < PriceToken price = { data . rentalFee } deposit = { data . deposit } /> }
24+ { isSale && < PriceToken price = { data . salePrice } /> }
3825 </ div >
3926 </ div >
4027 < div className = { s . Footer } >
Original file line number Diff line number Diff line change @@ -47,42 +47,6 @@ export const Price = css({
4747 gap : '0.125rem' ,
4848} ) ;
4949
50- export const PriceItem = css ( {
51- display : 'flex' ,
52- alignItems : 'center' ,
53- gap : '0.375rem' ,
54- '& > label' : {
55- padding : '0.125rem 0.25rem' ,
56- display : 'flex' ,
57- alignItems : 'center' ,
58- justifyContent : 'center' ,
59- rounded : '0.25rem' ,
60- bgColor : 'systemGray4' ,
61- color : '54' ,
62- fontSize : '0.625rem' ,
63- fontWeight : 500 ,
64- lineHeight : 1.4 ,
65- letterSpacing : '-0.025rem' ,
66- flexShrink : 0 ,
67- } ,
68- '& p' : {
69- color : '100' ,
70- fontSize : '1rem' ,
71- fontWeight : 600 ,
72- lineHeight : 1.4 ,
73- letterSpacing : '-0.04rem' ,
74- display : 'flex' ,
75- gap : '0.375rem' ,
76- alignItems : 'baseline' ,
77- '& > label' : {
78- color : '54' ,
79- fontSize : '0.875rem' ,
80- fontWeight : 500 ,
81- letterSpacing : '-0.035rem' ,
82- } ,
83- } ,
84- } ) ;
85-
8650export const Footer = css ( {
8751 display : 'flex' ,
8852 alignItems : 'center' ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export const PRODUCT_TYPES_MAP = {
66 SOCCER : '축구' ,
77 BASKETBALL : '농구' ,
88 BASEBALL : '야구' ,
9- HOCKEY : '아이스하키 ' ,
9+ HOCKEY : '하키 ' ,
1010 VARSITY_JACKET : '과잠' ,
1111 ACCESSORY : '악세사리' ,
1212 SELF_MADE : '자체제작' ,
You can’t perform that action at this time.
0 commit comments