Skip to content

Commit

Permalink
fix: made list draggable only by handle
Browse files Browse the repository at this point in the history
  • Loading branch information
knownotunknown authored and doprz committed Mar 6, 2024
1 parent 4375118 commit cbb190b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/shared/types/CourseMeeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
9 changes: 7 additions & 2 deletions src/views/components/common/CalendarGrid/CalendarGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Props>): JSX.Element {
export function Calendar({ courseMeetingBlocks }: React.PropsWithChildren<Props>): JSX.Element {

return (
<div className={styles.calendar}>
Expand Down Expand Up @@ -57,8 +57,13 @@ export function Calendar({ CourseMeetingBlocks }: React.PropsWithChildren<Props>
{grid.map((row, rowIndex) => row)}
</div>
</div>
{courseMeetingBlocks.map((block: CourseMeeting, index: number) => (
<div key={index}>
{block}
</div>
))}
</div>
);
);
};

export default Calendar;
5 changes: 2 additions & 3 deletions src/views/components/common/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,13 @@ const List: React.FC<ListProps> = ({ draggableElements, itemHeight, listHeight,
<div
ref={draggableProvided.innerRef}
{...draggableProvided.draggableProps}
{...draggableProvided.dragHandleProps}
style={{
...draggableProvided.draggableProps.style,
// if last item, don't add margin
marginBottom: index === items.length - 1 ? '0px' : `${gap}px`,
marginBottom: `${gap}px`,
}}
>
{item.content}
{React.cloneElement(item.content, { dragHandleProps: draggableProvided.dragHandleProps })}
</div>
)}
</Draggable>
Expand Down

0 comments on commit cbb190b

Please sign in to comment.