fix: made list draggable only by handle
This commit is contained in:
@@ -15,7 +15,7 @@ export const DAY_MAP = {
|
|||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
/** A day of the week that a class is taught */
|
/** 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 */
|
/** A physical room that a class is taught in */
|
||||||
export type Location = {
|
export type Location = {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ interface Props {
|
|||||||
* Grid of CalendarGridCell components forming the user's course schedule calendar view
|
* Grid of CalendarGridCell components forming the user's course schedule calendar view
|
||||||
* @param props
|
* @param props
|
||||||
*/
|
*/
|
||||||
export function Calendar({ CourseMeetingBlocks }: React.PropsWithChildren<Props>): JSX.Element {
|
export function Calendar({ courseMeetingBlocks }: React.PropsWithChildren<Props>): JSX.Element {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.calendar}>
|
<div className={styles.calendar}>
|
||||||
@@ -57,8 +57,13 @@ export function Calendar({ CourseMeetingBlocks }: React.PropsWithChildren<Props>
|
|||||||
{grid.map((row, rowIndex) => row)}
|
{grid.map((row, rowIndex) => row)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{courseMeetingBlocks.map((block: CourseMeeting, index: number) => (
|
||||||
|
<div key={index}>
|
||||||
|
{block}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
);
|
};
|
||||||
|
|
||||||
export default Calendar;
|
export default Calendar;
|
||||||
|
|||||||
@@ -144,14 +144,13 @@ const List: React.FC<ListProps> = ({ draggableElements, itemHeight, listHeight,
|
|||||||
<div
|
<div
|
||||||
ref={draggableProvided.innerRef}
|
ref={draggableProvided.innerRef}
|
||||||
{...draggableProvided.draggableProps}
|
{...draggableProvided.draggableProps}
|
||||||
{...draggableProvided.dragHandleProps}
|
|
||||||
style={{
|
style={{
|
||||||
...draggableProvided.draggableProps.style,
|
...draggableProvided.draggableProps.style,
|
||||||
// if last item, don't add margin
|
// 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>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Draggable>
|
</Draggable>
|
||||||
|
|||||||
Reference in New Issue
Block a user