implement drag&drop in calendar

This commit is contained in:
marlon-erler
2024-07-26 07:07:07 +02:00
parent 43363a4ed1
commit efe4a87b63
6 changed files with 76 additions and 14 deletions
+9 -1
View File
@@ -4,10 +4,12 @@ import * as React from "bloatless-react";
import { MonthGrid } from "../../Model/Files/calendarModel";
import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
import { translations } from "../translations";
import { allowDrop } from "../utility";
export function MonthGrid<T>(
monthGrid: MonthGrid<React.MapState<T>>,
selectedDate: React.State<number>
selectedDate: React.State<number>,
handleDrop: (date: string) => void
) {
const dayLabels: HTMLElement[] = [];
let currentWeekday = monthGrid.firstDayOfWeek;
@@ -61,12 +63,18 @@ export function MonthGrid<T>(
selectedDate.value = parseInt(date);
}
function drop() {
handleDrop(date);
}
return (
<button
class="tile"
on:click={select}
toggle:selected={isSelected}
toggle:today={isToday}
on:dragover={allowDrop}
on:drop={drop}
>
<div>
<b>{date}</b>