diff --git a/src/components/MyPage/CombinationList.tsx b/src/components/MyPage/CombinationList.tsx index f0e7b94..a410e38 100644 --- a/src/components/MyPage/CombinationList.tsx +++ b/src/components/MyPage/CombinationList.tsx @@ -245,7 +245,15 @@ const CombinationList = ({ createdAt={combination.createdAt} isPinned={combination.isPinned} index={index} + isEditing={combinationEdit.editingComboId === combination.comboId} + editingName={combinationEdit.editingCombinationName} + nameError={combinationEdit.comboNameError} onTogglePin={handleTogglePin} + onNameChange={combinationEdit.handleComboNameChange} + onNameBlur={(name) => { + const error = combinationEdit.validateComboName(name); + combinationEdit.setComboNameError(error); + }} /> )} diff --git a/src/components/MyPage/EmptyCombinationCard.tsx b/src/components/MyPage/EmptyCombinationCard.tsx index 79de2a3..0344214 100644 --- a/src/components/MyPage/EmptyCombinationCard.tsx +++ b/src/components/MyPage/EmptyCombinationCard.tsx @@ -12,7 +12,12 @@ interface EmptyCombinationCardProps { createdAt: string; isPinned: boolean; index: number; + isEditing: boolean; + editingName: string; + nameError: string | null; onTogglePin: (e: React.MouseEvent, comboId: number) => void; + onNameChange: (e: React.ChangeEvent) => void; + onNameBlur: (name: string) => void; } const EmptyCombinationCard = ({ @@ -21,7 +26,12 @@ const EmptyCombinationCard = ({ createdAt, isPinned, index, + isEditing, + editingName, + nameError, onTogglePin, + onNameChange, + onNameBlur, }: EmptyCombinationCardProps) => { const navigate = useNavigate(); const [hoveredStarComboId, setHoveredStarComboId] = useState(null); @@ -30,44 +40,93 @@ const EmptyCombinationCard = ({
{/* 조합 정보 (생성일 포함) */}
- {/* 조합 번호 + 생성일 + 조합명 */} -
-
-

조합{index + 1}

-

생성일: {formatDate(createdAt)}

-
-
-

{comboName}

- {isPinned ? ( - onTogglePin(e, comboId)} - className={`!w-22 !h-22 -mt-3 cursor-pointer transition-opacity ${ - hoveredStarComboId === comboId ? 'opacity-80' : '' + {isEditing ? ( + /* 수정 모드: 인풋박스 + 별 아이콘 + 에러 메시지 */ +
+
+ e.stopPropagation()} + onBlur={() => onNameBlur(editingName)} + maxLength={20} + className={`h-52 px-12 rounded-button font-body-1-sm text-gray-300 focus:outline-none ${ + nameError ? 'border-2 border-warning' : 'border border-blue-600' }`} - onMouseEnter={() => setHoveredStarComboId(comboId)} - onMouseLeave={() => setHoveredStarComboId(null)} + autoFocus /> - ) : ( - <> - {hoveredStarComboId === comboId ? ( - onTogglePin(e, comboId)} - className="!w-22 !h-22 -mt-3 cursor-pointer" - onMouseEnter={() => setHoveredStarComboId(comboId)} - onMouseLeave={() => setHoveredStarComboId(null)} - /> - ) : ( - onTogglePin(e, comboId)} - className="!w-22 !h-22 -mt-3 cursor-pointer" - onMouseEnter={() => setHoveredStarComboId(comboId)} - onMouseLeave={() => setHoveredStarComboId(null)} - /> - )} - - )} + {isPinned ? ( + onTogglePin(e, comboId)} + className={`!w-22 !h-22 -mt-2 cursor-pointer transition-opacity ${ + hoveredStarComboId === comboId ? 'opacity-80' : '' + }`} + onMouseEnter={() => setHoveredStarComboId(comboId)} + onMouseLeave={() => setHoveredStarComboId(null)} + /> + ) : ( + <> + {hoveredStarComboId === comboId ? ( + onTogglePin(e, comboId)} + className="!w-22 !h-22 -mt-2 cursor-pointer" + onMouseEnter={() => setHoveredStarComboId(comboId)} + onMouseLeave={() => setHoveredStarComboId(null)} + /> + ) : ( + onTogglePin(e, comboId)} + className="!w-22 !h-22 -mt-2 cursor-pointer" + onMouseEnter={() => setHoveredStarComboId(comboId)} + onMouseLeave={() => setHoveredStarComboId(null)} + /> + )} + + )} +
+ {nameError &&

{nameError}

} +
+ ) : ( + /* 일반 모드: 조합 번호 + 생성일 + 조합명 */ +
+
+

조합{index + 1}

+

생성일: {formatDate(createdAt)}

+
+
+

{comboName}

+ {isPinned ? ( + onTogglePin(e, comboId)} + className={`!w-22 !h-22 -mt-3 cursor-pointer transition-opacity ${ + hoveredStarComboId === comboId ? 'opacity-80' : '' + }`} + onMouseEnter={() => setHoveredStarComboId(comboId)} + onMouseLeave={() => setHoveredStarComboId(null)} + /> + ) : ( + <> + {hoveredStarComboId === comboId ? ( + onTogglePin(e, comboId)} + className="!w-22 !h-22 -mt-3 cursor-pointer" + onMouseEnter={() => setHoveredStarComboId(comboId)} + onMouseLeave={() => setHoveredStarComboId(null)} + /> + ) : ( + onTogglePin(e, comboId)} + className="!w-22 !h-22 -mt-3 cursor-pointer" + onMouseEnter={() => setHoveredStarComboId(comboId)} + onMouseLeave={() => setHoveredStarComboId(null)} + /> + )} + + )} +
-
+ )}
{/* 빈 조합: 기기 추가 버튼 */}