@@ -3,7 +3,7 @@ import { useRouter } from "next/router";
33import clsx from "clsx" ;
44import Image from "next/image" ;
55
6- interface CardButtonProps extends React . ButtonHTMLAttributes < HTMLDivElement > {
6+ interface CardButtonProps extends React . HTMLAttributes < HTMLDivElement > {
77 title ?: string ;
88 showCrown ?: boolean ;
99 color ?: string ;
@@ -12,29 +12,31 @@ interface CardButtonProps extends React.ButtonHTMLAttributes<HTMLDivElement> {
1212 createdByMe ?: boolean ;
1313 onDeleteClick ?: ( id : number ) => void ;
1414 onLeaveClick ?: ( id : number ) => void ;
15+ attributes ?: React . HTMLAttributes < HTMLDivElement > ;
16+ listeners ?: React . HTMLAttributes < HTMLDivElement > ;
1517}
1618
1719const CardButton : React . FC < CardButtonProps > = ( {
1820 className,
1921 title = "비브리지" ,
2022 showCrown = true ,
21- color = "#7ac555" , // 기본 색상
23+ color = "#7ac555" ,
2224 isEditMode = false ,
2325 dashboardId,
2426 createdByMe,
2527 onDeleteClick,
2628 onLeaveClick,
29+ attributes,
30+ listeners,
2731 ...props
2832} ) => {
2933 const router = useRouter ( ) ;
3034
3135 const handleCardClick = ( e : React . MouseEvent < HTMLDivElement > ) => {
32- // 관리 상태에서 카드 클릭 이벤트 차단
3336 if ( isEditMode ) {
3437 e . preventDefault ( ) ;
3538 return ;
3639 }
37- // 카드 클릭 시 해당 대시보드로 이동
3840 router . push ( `/dashboard/${ dashboardId } ` ) ;
3941 } ;
4042
@@ -46,16 +48,16 @@ const CardButton: React.FC<CardButtonProps> = ({
4648 const handleDelete = ( e : React . MouseEvent ) => {
4749 e . stopPropagation ( ) ;
4850 if ( createdByMe ) {
49- // 실제 삭제 API 요청
50- if ( onDeleteClick ) onDeleteClick ( dashboardId ) ;
51+ onDeleteClick ?.( dashboardId ) ;
5152 } else {
52- // 나만 탈퇴
53- if ( onLeaveClick ) onLeaveClick ( dashboardId ) ;
53+ onLeaveClick ?.( dashboardId ) ;
5454 }
5555 } ;
5656
5757 return (
5858 < div
59+ { ...attributes }
60+ { ...listeners }
5961 { ...props }
6062 onClick = { handleCardClick }
6163 className = { clsx (
@@ -64,7 +66,7 @@ const CardButton: React.FC<CardButtonProps> = ({
6466 "border border-[var(--color-gray3)]" ,
6567 "min-w-0 w-full max-w-[260px] md:max-w-[247px] lg:max-w-[332px]" ,
6668 "h-[58px] md:h-[68px] lg:h-[70px]" ,
67- "mt-[2px]" , // 카드 세로 간격
69+ "mt-[2px]" ,
6870 "text-lg md:text-2lg lg:text-2lg" ,
6971 isEditMode
7072 ? "cursor-default hover:border-gray-300"
@@ -74,30 +76,25 @@ const CardButton: React.FC<CardButtonProps> = ({
7476 >
7577 { /* 왼쪽: 색상 도트 + 제목 + 왕관 */ }
7678 < div className = "flex items-center overflow-hidden font-semibold gap-[10px]" >
77- { /* 색상 원 */ }
7879 < svg width = "8" height = "8" viewBox = "0 0 8 8" fill = { color } >
7980 < circle cx = "4" cy = "4" r = "4" />
8081 </ svg >
81-
82- { /* 제목 */ }
8382 < span className = "text-black3 text-[14px] sm:text-[16px] truncate max-w-[120px]" >
8483 { title }
8584 </ span >
86-
87- { /* 왕관 */ }
88- < div className = "relative w-[15px] h-[12px] md:w-[17px] md:h-[14px]" >
89- { showCrown && (
85+ { showCrown && (
86+ < div className = "relative w-[15px] h-[12px] md:w-[17px] md:h-[14px]" >
9087 < Image
9188 src = "/svgs/icon-crown.svg"
9289 alt = "crown Icon"
9390 fill
9491 className = "object-contain"
9592 />
96- ) }
97- </ div >
93+ </ div >
94+ ) }
9895 </ div >
9996
100- { /* 오른쪽: 화살표 아이콘 or 수정/삭제 버튼 */ }
97+ { /* 오른쪽: 수정/삭제 버튼 또는 아이콘 */ }
10198 { isEditMode ? (
10299 < div className = "flex flex-col gap-2" >
103100 { createdByMe && (
0 commit comments