-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Member] 캘린더 사용자 피드백 개선
- Loading branch information
Showing
6 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
apps/member/src/components/calendar/CalendarTableSection/CalendarTableSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useCallback } from 'react'; | ||
|
||
import { Table } from '@clab/design-system'; | ||
|
||
import { Section } from '@components/common/Section'; | ||
|
||
import { TABLE_HEAD } from '@constants/head'; | ||
import useModal from '@hooks/common/useModal'; | ||
import { useSchedule } from '@hooks/queries'; | ||
import { formattedDate, formattedDatePeriod } from '@utils/date'; | ||
|
||
const CalendarTableSection = () => { | ||
const { openModal } = useModal(); | ||
const { data } = useSchedule(); | ||
|
||
const handleScheduleClick = useCallback( | ||
(detail: string, startDate: string, endDate: string) => { | ||
openModal({ | ||
title: '📆 일정', | ||
content: `일시: ${formattedDatePeriod(startDate, endDate)}\n내용: ${detail}`, | ||
}); | ||
}, | ||
[openModal], | ||
); | ||
|
||
return ( | ||
<Section> | ||
<Table head={TABLE_HEAD.CALENDAR_TABLE} className="table-fixed"> | ||
{data.items.map(({ id, title, detail, startDate, endDate }) => ( | ||
<Table.Row | ||
key={id} | ||
onClick={() => handleScheduleClick(detail, startDate, endDate)} | ||
> | ||
<Table.Cell>{`${formattedDate(startDate)} ~ ${formattedDate(endDate)}`}</Table.Cell> | ||
<Table.Cell>{title}</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table> | ||
</Section> | ||
); | ||
}; | ||
|
||
export default CalendarTableSection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters