From cbb190bf4b3ad694c87b650489e1fca5aa6b7826 Mon Sep 17 00:00:00 2001 From: knownotunknown <78577376+knownotunknown@users.noreply.github.com> Date: Sat, 17 Feb 2024 12:23:52 -0600 Subject: [PATCH] fix: made list draggable only by handle --- src/shared/types/CourseMeeting.ts | 2 +- .../components/common/CalendarGrid/CalendarGrid.tsx | 9 +++++++-- src/views/components/common/List/List.tsx | 5 ++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/shared/types/CourseMeeting.ts b/src/shared/types/CourseMeeting.ts index 62c49f02..5333a227 100644 --- a/src/shared/types/CourseMeeting.ts +++ b/src/shared/types/CourseMeeting.ts @@ -15,7 +15,7 @@ export const DAY_MAP = { } as const; /** A day of the week that a class is taught */ -export type Day = typeof DAY_MAP[keyof typeof DAY_MAP]; +export type Day = (typeof DAY_MAP)[keyof typeof DAY_MAP]; /** A physical room that a class is taught in */ export type Location = { diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.tsx b/src/views/components/common/CalendarGrid/CalendarGrid.tsx index 6d931dd7..3d83ef9a 100644 --- a/src/views/components/common/CalendarGrid/CalendarGrid.tsx +++ b/src/views/components/common/CalendarGrid/CalendarGrid.tsx @@ -29,7 +29,7 @@ interface Props { * Grid of CalendarGridCell components forming the user's course schedule calendar view * @param props */ -export function Calendar({ CourseMeetingBlocks }: React.PropsWithChildren): JSX.Element { +export function Calendar({ courseMeetingBlocks }: React.PropsWithChildren): JSX.Element { return (
@@ -57,8 +57,13 @@ export function Calendar({ CourseMeetingBlocks }: React.PropsWithChildren {grid.map((row, rowIndex) => row)}
+ {courseMeetingBlocks.map((block: CourseMeeting, index: number) => ( +
+ {block} +
+ ))} ); -); +}; export default Calendar; diff --git a/src/views/components/common/List/List.tsx b/src/views/components/common/List/List.tsx index 54d96b33..8f2f24b5 100644 --- a/src/views/components/common/List/List.tsx +++ b/src/views/components/common/List/List.tsx @@ -144,14 +144,13 @@ const List: React.FC = ({ draggableElements, itemHeight, listHeight,
- {item.content} + {React.cloneElement(item.content, { dragHandleProps: draggableProvided.dragHandleProps })}
)}