1
0
Fork 0

TaskProps interface

This commit is contained in:
Tomas Balsys 2024-10-27 02:02:38 +03:00
parent b9686aed78
commit 5bb5ffef17
3 changed files with 12 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import { useState } from 'react'
import { taskTypes, taskStatuses } from './consts'; import { taskTypes, taskStatuses } from './consts';
import { EnumSelect } from './enum-select'; import { EnumSelect } from './enum-select';
export function TaskRow({ task, updateTask, deleteTask, orderTasks }: { task: TodoTask, updateTask: (task: TodoTask) => void, deleteTask: (id: number) => void, orderTasks: (from: number, to: number) => void }): JSX.Element { export function TaskRow({ task, updateTask, deleteTask, orderTasks }: TaskProps & { task: TodoTask }) {
const [edit, setEdit] = useState(false); const [edit, setEdit] = useState(false);
const [classnames, setClassnames] = useState<string[]>([]); const [classnames, setClassnames] = useState<string[]>([]);

View File

@ -1,7 +1,7 @@
import { } from 'react' import { } from 'react'
import { TaskRow } from './task-row'; import { TaskRow } from './task-row';
export function TaskTable({ tasks, ...rest }: { tasks: TodoTasks, updateTask: (task: TodoTask) => void, deleteTask: (id: number) => void, orderTasks: (from: number, to: number) => void }): JSX.Element { export function TaskTable({ tasks, ...rest }: TaskProps & { tasks: TodoTasks }) {
return ( return (
<div className="w-full"> <div className="w-full">
<div className="tr"> <div className="tr">

8
src/vite-env.d.ts vendored
View File

@ -2,12 +2,16 @@
type TaskType = 'task' | 'bug'; type TaskType = 'task' | 'bug';
type TaskStatus = 'paused' | 'in progress' | 'testing' | 'released'; type TaskStatus = 'paused' | 'in progress' | 'testing' | 'released';
class TodoTask { interface TodoTask {
id: number; id: number;
type: TaskType; type: TaskType;
title: string; title: string;
status: TaskStatus; status: TaskStatus;
} }
type TodoTasks = TodoTask[]; type TodoTasks = TodoTask[];
interface TaskProps {
updateTask: (task: TodoTask) => void;
deleteTask: (id: number) => void;
orderTasks: (from: number, to: number) => void;
}