-
Notifications
You must be signed in to change notification settings - Fork 5
[UI] 목표 상세페이지 구현 #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UI] 목표 상세페이지 구현 #94
Changes from all commits
eb4ae02
7b852cf
37c1c7d
245ca40
e9d0c54
d6ff12f
ea6246b
d2953d6
ee3b78e
5cf8742
080c60c
d4ea6e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,17 +14,36 @@ import pr2 from '../../assets/icons/pr-2-sm.svg'; | |
| import pr3 from '../../assets/icons/pr-3-sm.svg'; | ||
| import pr4 from '../../assets/icons/pr-4-sm.svg'; | ||
| import IcProfile from '../../assets/icons/user-circle-sm.svg'; | ||
| // import IcDate from '../../assets/icons/date-lg.svg'; | ||
| // import IcIssue from '../../assets/icons/issue.svg'; | ||
| import IcCalendar from '../../assets/icons/date-lg.svg'; | ||
| import IcIssue from '../../assets/icons/issue.svg'; | ||
|
|
||
| import { getStatusColor } from '../../utils/listItemUtils'; | ||
| import { statusLabelToCode } from '../../types/detailitem'; | ||
| import CommentSection from '../../components/DetailView/Comment/CommentSection'; | ||
| import CalendarDropdown from '../../components/Calendar/CalendarDropdown'; | ||
| import { useDropdownActions, useDropdownInfo } from '../../hooks/useDropdown'; | ||
| import { formatDateDot } from '../../utils/formatDate'; | ||
| import ArrowDropdown from '../../components/Dropdown/ArrowDropdown'; | ||
|
|
||
| const GoalDetail = () => { | ||
| const [title, setTitle] = useState(''); | ||
| const [isCompleted, setIsCompleted] = useState(false); | ||
|
|
||
| // '기한' 속성의 달력 드롭다운: 시작일, 종료일 2개를 저장 | ||
| const [selectedDate, setSelectedDate] = useState<[Date | null, Date | null]>([null, null]); | ||
|
|
||
| const [option, setOption] = useState<string>('이슈'); | ||
| const { isOpen, content } = useDropdownInfo(); // 현재 드롭다운의 열림 여부와 내용 가져옴 | ||
| const { openDropdown, closeDropdown } = useDropdownActions(); | ||
|
|
||
| // '기한' 속성의 텍스트(시작일, 종료일) 결정하는 함수 | ||
| const getDisplayText = () => { | ||
| const [start, end] = selectedDate; | ||
| if (start && end) return `${formatDateDot(start)} - ${formatDateDot(end)}`; // 시작일과 종료일 둘 다 있을 경우 | ||
| if (start || end) return formatDateDot(start ?? end!); // 날짜 하나만 선택된 경우 | ||
| return '기한'; // 날짜 선택 안 된 경우: default로 '기한' 글씨가 그대로 보이도록 | ||
| }; | ||
|
|
||
| // '우선순위' 속성 아이콘 매핑 | ||
| const priorityIconMap = { | ||
| 우선순위: pr3, | ||
|
|
@@ -58,7 +77,7 @@ const GoalDetail = () => { | |
| {/* 상세페이지 메인 */} | ||
| <div className="flex px-[3.2rem] gap-[8.8rem] w-full h-full"> | ||
| {/* 상세페이지 좌측 영역 - 제목 & 상세설명 & 댓글 */} | ||
| <div className="flex flex-col gap-[3.2rem] w-[calc(100%-33rem)]"> | ||
| <div className="flex flex-col gap-[3.2rem] w-[calc(100%-33rem)] h-full"> | ||
| {/* 상세페이지 제목 */} | ||
| <DetailTitle | ||
| defaultTitle="목표를 생성하세요" | ||
|
|
@@ -111,19 +130,59 @@ const GoalDetail = () => { | |
| </div> | ||
|
|
||
| {/* (4) 기한 */} | ||
| {/* <PropertyItem defaultValue="기한" iconMap={{ 기한: dateIconMap }} /> */} | ||
| <div | ||
| onClick={(e) => { | ||
| e.stopPropagation(); | ||
| openDropdown({ name: 'date' }); | ||
| }} | ||
| className="flex w-full h-[3.2rem] px-[0.5rem] rounded-md items-center gap-[0.8rem] mb-[1.6rem] whitespace-nowrap hover:bg-gray-200 cursor-pointer" | ||
| > | ||
| {/* '기한' 속성 아이콘 */} | ||
| <img src={IcCalendar} alt="date" /> | ||
| <div className="relative"> | ||
| {/* '기한' 항목명 - 날짜 설정하면 반영됨 */} | ||
| <span className={`font-body-r text-gray-600`}>{getDisplayText()}</span> | ||
| {/* 달력 드롭다운 오픈 */} | ||
| {isOpen && content?.name === 'date' && ( | ||
| <CalendarDropdown | ||
| selectedDate={selectedDate} | ||
| onSelect={(date) => setSelectedDate(date)} | ||
| /> | ||
| )} | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* (5) 이슈 */} | ||
| {/** | ||
| * @todo | ||
| * - 이슈 많아질 경우 '외 n개'로 축약되게 하기 | ||
| */} | ||
| {/* | ||
| <PropertyItem | ||
| defaultValue="이슈" | ||
| iconMap={{ 이슈: issueIconMap }} | ||
| /> | ||
| */} | ||
| <div | ||
| onClick={(e) => { | ||
| e.stopPropagation(); | ||
| openDropdown({ name: '이슈' }); | ||
| }} | ||
| className={`flex w-full h-[3.2rem] px-[0.5rem] rounded-md items-center gap-[0.8rem] mb-[1.6rem] whitespace-nowrap hover:bg-gray-200 cursor-pointer`} | ||
| > | ||
| {/* 속성 아이콘 */} | ||
| <img src={IcIssue} alt="이슈" /> | ||
|
|
||
| {/* 속성 이름 */} | ||
| <div className="flex relative"> | ||
| {/* 속성 항목명 */} | ||
| <p className="font-body-r text-gray-600 max-w-[27.4rem] truncate">{option}</p> | ||
|
|
||
| {/* 드롭다운 오픈 */} | ||
| {isOpen && content?.name === '이슈' && ( | ||
| <ArrowDropdown | ||
| defaultValue={'이슈'} | ||
| options={[ | ||
| '기능 정의: 구현할 핵심 기능과 어쩌구 저쩌구 텍스트가 길어지면 이렇게 표시', | ||
| '와이어프레임 디자인', | ||
| '컴포넌트 정리', | ||
| ]} | ||
| onSelect={(value: string) => setOption(value)} | ||
| onClose={closeDropdown} | ||
| /> | ||
| )} | ||
|
Comment on lines
+172
to
+183
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: 드롭다운이 정상적으로 닫히지 않는 문제는 e.stopPropagation() 처리가 누락되어 발생한 것으로 확인되었습니다... <div
ref={dropdownRef}
style={{ boxShadow: '0px 4px 12px 0px rgba(0, 0, 0, 0.15)' }}
className={`absolute z-30 top-0 left-0 flex flex-col w-[27.4rem]
border border-gray-400 bg-white rounded-[0.4rem] ${className}`}
onClick={(e) => e.stopPropagation()}
>
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이거는 아래 내용 보시면, 해당 속성 항목이 차지하는 전체 영역을 눌렀을 때 드롭다운이 열리게 하는 방식으로 UX를 개선하고자 e.stopPropagation() 처리도 속성 항목의 최상위 div에 적용을 했는데요, 바로 직속 상위 div 태그에 이벤트 처리하지 않고, 아래와 같은 방식으로 처리하면 해당 이벤트 처리가 안 먹히는 건가 싶어서 해당 e.stopPropagation() 처리만 최상위 div 태그가 아닌 바로 직속 상위 div 태그에 넣어봤는데, 이렇게 하면 문제는 해결되지만 대신에 바로 직속 상위 div 태그인 속성 이름을 클릭하면 드롭다운이 열리지 않는 문제가 생깁니다... 이 부분에 대해서도 한번만 봐주시면 좋을 것 같아요.... ㅠㅠ 어떻게 해야할지 모르겠습니다 @gaeulzzang
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아아 넵 해결했습니다!!! |
||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p2: 기한명 서식 2025.07.28 이 아닌 25.07.08 입니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 감사합니다 수정 반영하겠습니다~