Skip to content

Commit cdc4f5c

Browse files
committed
feat : 이벤트 카드
1 parent fcbaee2 commit cdc4f5c

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

src/shared/components/container/EventCard.tsx

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface EventCardProps {
1717
size?: 'small' | 'medium' | 'large';
1818
imageSrc?: string;
1919
liked?: boolean;
20-
onClick?: () => void;
20+
onClick?: () => void;
2121
}
2222

2323
const EventCard = ({
@@ -34,8 +34,6 @@ const EventCard = ({
3434
const { isBookmarked, toggleBookmark, requireLogin, setRequireLogin } =
3535
useBookmark(eventId, liked);
3636

37-
38-
3937
return (
4038
<>
4139
{requireLogin && <LoginRequired onClose={() => setRequireLogin(false)} />}
@@ -49,70 +47,70 @@ const EventCard = ({
4947
onClick={onClick}
5048
>
5149
{size === 'small' ? (
52-
<div className="flex w-[17rem] h-[8rem] p-[0.9rem_1rem] justify-center items-center flex-shrink-0 gap-[2rem]">
53-
{/* 행사 사진 */}
54-
<div className="relative w-[7rem] h-full rounded-[0.8rem] flex-shrink-0 overflow-hidden">
50+
<div className='flex w-[17rem] h-[8rem] p-[0.9rem_1rem] justify-center items-center flex-shrink-0 gap-[2rem]'>
51+
{/* 행사 사진 */}
52+
<div className='relative w-[7rem] h-full rounded-[0.8rem] flex-shrink-0 overflow-hidden'>
5553
{imageSrc ? (
5654
<Image
5755
src={imageSrc}
5856
alt={name}
5957
fill
60-
className="object-cover"
61-
sizes="7rem"
62-
loading="lazy"
58+
className='object-cover'
59+
sizes='7rem'
60+
loading='lazy'
6361
/>
6462
) : (
65-
<div className="absolute inset-0 bg-gray-200 rounded-[0.8rem]" />
63+
<div className='absolute inset-0 bg-gray-200 rounded-[0.8rem]' />
6664
)}
6765
</div>
6866
{/* 행사 이름*/}
6967
<span
7068
className={cn(
7169
'text-label-md truncate mb-[3rem]',
72-
variant === 'mint' ? 'text-mint-800' : 'text-gray-600'
70+
variant === 'mint' ? 'text-mint-800' : 'text-gray-600',
7371
)}
7472
>
7573
{name}
7674
</span>
7775
</div>
7876
) : size === 'medium' ? (
79-
<div className="flex flex-col justify-between w-full">
77+
<div className='flex flex-col justify-between w-full'>
8078
{/* 행사 사진 */}
81-
<div className="relative w-full h-[9rem] rounded-[2rem] mb-[1rem] overflow-hidden">
79+
<div className='relative w-full h-[9rem] rounded-[2rem] mb-[1rem] overflow-hidden'>
8280
{imageSrc ? (
8381
<Image
8482
src={imageSrc}
8583
alt={name}
8684
fill
87-
className="object-cover"
85+
className='object-cover'
8886
//성능향상 - 이미지 최적화
89-
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 142px"
90-
loading="lazy"
87+
sizes='(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 142px'
88+
loading='lazy'
9189
/>
9290
) : (
93-
<div className="w-full h-full bg-gray-200" />
91+
<div className='w-full h-full bg-gray-200' />
9492
)}
9593
</div>
9694
{/* 행사 이름 + 하트 */}
97-
<div className="flex items-center justify-between w-full mb-[0.2rem]">
95+
<div className='flex items-center justify-between w-full mb-[0.2rem]'>
9896
<span
9997
className={cn(
10098
'text-label-lg truncate', //1줄 초과
101-
variant === 'mint' ? 'text-mint-800' : 'text-gray-900'
99+
variant === 'mint' ? 'text-mint-800' : 'text-gray-900',
102100
)}
103101
>
104102
{name}
105103
</span>
106104

107105
<button
108-
className="cursor-pointer p-1"
106+
className='cursor-pointer p-1'
109107
onClick={(e) => {
110108
e.stopPropagation();
111109
toggleBookmark();
112110
}}
113111
>
114112
<Icon
115-
name="HeartStraight"
113+
name='HeartStraight'
116114
size={20}
117115
color={
118116
isBookmarked
@@ -129,36 +127,36 @@ const EventCard = ({
129127
<div
130128
className={cn(
131129
'text-body-md truncate', //1줄 초과
132-
variant === 'mint' ? 'text-mint-500' : 'text-gray-500'
130+
variant === 'mint' ? 'text-mint-500' : 'text-gray-500',
133131
)}
134132
>
135133
{description}
136134
</div>
137135
</div>
138136
) : (
139-
// Large 카드
140-
<div className="flex items-start justify-between w-full gap-[1.2rem]">
137+
// Large 카드
138+
<div className='flex items-start justify-between w-full gap-[1.2rem]'>
141139
{/* 행사 제목 + 하트 */}
142-
<div className="flex flex-col justify-between flex-1">
143-
<div className="flex items-start justify-between w-full">
140+
<div className='flex flex-col justify-between flex-1'>
141+
<div className='flex items-start justify-between w-full'>
144142
<span
145143
className={cn(
146144
'text-label-lg truncate', //1줄 초과
147-
variant === 'mint' ? 'text-mint-800' : 'text-gray-900'
145+
variant === 'mint' ? 'text-mint-800' : 'text-gray-900',
148146
)}
149147
>
150148
{name}
151149
</span>
152150

153151
<button
154-
className="cursor-pointer p-1"
152+
className='cursor-pointer p-1'
155153
onClick={(e) => {
156154
e.stopPropagation();
157155
toggleBookmark();
158156
}}
159157
>
160158
<Icon
161-
name="HeartStraight"
159+
name='HeartStraight'
162160
size={20}
163161
color={
164162
isBookmarked
@@ -171,11 +169,11 @@ const EventCard = ({
171169
/>
172170
</button>
173171
</div>
174-
{/* 행사 설명 */}
172+
{/* 행사 설명 */}
175173
<p
176174
className={cn(
177175
'text-body-md mt-[1rem] line-clamp-4 text-left',
178-
variant === 'mint' ? 'text-mint-500' : 'text-gray-500'
176+
variant === 'mint' ? 'text-mint-500' : 'text-gray-500',
179177
)}
180178
>
181179
{description}

0 commit comments

Comments
 (0)