diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx index 51b74dd..3ac24f5 100644 --- a/src/components/ui/table.tsx +++ b/src/components/ui/table.tsx @@ -70,7 +70,7 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) { [role=checkbox]]:translate-y-[2px]", + "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5", className )} {...props} @@ -83,7 +83,7 @@ function TableCell({ className, ...props }: React.ComponentProps<"td">) { [role=checkbox]]:translate-y-[2px]", + "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5", className )} {...props} diff --git a/src/components/view/TaskEdit.tsx b/src/components/view/TaskEdit.tsx new file mode 100644 index 0000000..eacbd04 --- /dev/null +++ b/src/components/view/TaskEdit.tsx @@ -0,0 +1,72 @@ +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { MultiSelect } from "@/components/ui/multi-select"; +import { + Sheet, + SheetContent, + SheetDescription, + SheetHeader, + SheetTitle, +} from "@/components/ui/sheet"; +import { Task } from "@/lib/types"; +import { Color, getColor } from "@/lib/ui/color"; +import { DraggableProvided } from "@hello-pangea/dnd"; + +export default function TaskEdit({ + task, + setTask, + tags, + children, +}: { + task: Task; + setTask: (t: Task) => void; + tags: Record; + children: React.ReactNode; +}) { + return ( + + {children} + + + Edit task + + Make changes to the task here. Click save when you're done. + + +
+
+ + setTask({ ...task, title: e.target.value })} + /> +
+
+ + + setTask({ ...task, description: e.target.value }) + } + /> +
+
+ + ({ + label: tag.name, + value: id, + style: { + iconColor: getColor(tag.color).color, + badgeColor: getColor(tag.color).backgroundColor, + }, + }))} + onValueChange={(tags) => setTask({ ...task, tags })} + defaultValue={task.tags} + /> +
+
+
+
+ ); +} diff --git a/src/components/view/board/Task.tsx b/src/components/view/board/Task.tsx index e62f078..5cd0151 100644 --- a/src/components/view/board/Task.tsx +++ b/src/components/view/board/Task.tsx @@ -6,20 +6,11 @@ import { CardHeader, CardTitle, } from "@/components/ui/card"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { MultiSelect } from "@/components/ui/multi-select"; -import { - Sheet, - SheetContent, - SheetDescription, - SheetHeader, - SheetTitle, - SheetTrigger, -} from "@/components/ui/sheet"; +import { SheetTrigger } from "@/components/ui/sheet"; import { Task } from "@/lib/types"; import { Color, getColor } from "@/lib/ui/color"; import { DraggableProvided } from "@hello-pangea/dnd"; +import TaskEdit from "../TaskEdit"; export default function BoardTask({ task, @@ -33,7 +24,7 @@ export default function BoardTask({ tags: Record; }) { return ( - + - - - Edit task - - Make changes to the task here. Click save when you're done. - - -
-
- - setTask({ ...task, title: e.target.value })} - /> -
-
- - - setTask({ ...task, description: e.target.value }) - } - /> -
-
- - ({ - label: tag.name, - value: id, - style: { - iconColor: getColor(tag.color).color, - badgeColor: getColor(tag.color).backgroundColor, - }, - }))} - onValueChange={(tags) => setTask({ ...task, tags })} - defaultValue={task.tags} - /> - {/* - setTask({ ...task, description: e.target.value }) - } - /> */} -
-
-
-
+ ); } diff --git a/src/components/view/table/Task.tsx b/src/components/view/table/Task.tsx index ee2d9d4..4d17eef 100644 --- a/src/components/view/table/Task.tsx +++ b/src/components/view/table/Task.tsx @@ -1,7 +1,9 @@ import { Badge } from "@/components/ui/badge"; +import { SheetTrigger } from "@/components/ui/sheet"; import { TableCell, TableRow } from "@/components/ui/table"; import { Task } from "@/lib/types"; import { Color, getColor } from "@/lib/ui/color"; +import TaskEdit from "../TaskEdit"; export default function TableTask({ task, @@ -13,31 +15,39 @@ export default function TableTask({ tags: Record; }) { return ( - - {task.title} - - {task.description || "-"} - - - - {task.status} - - - - {task.tags?.map((tag, i) => ( - - {tag} - - ))} - - + + + + {task.title} + + {task.description || "-"} + + + + {task.status} + + + + {task.tags?.map((tag, i) => ( + + {tag} + + ))} + + + + ); }