diff --git a/src/components/enum-select.tsx b/src/components/enum-select.tsx index 26cba22..2ecff27 100644 --- a/src/components/enum-select.tsx +++ b/src/components/enum-select.tsx @@ -1,9 +1,9 @@ import { } from 'react' -export function EnumSelect({ name, entries, value }: { name: string; entries: Record, value?: string }): JSX.Element { +export function EnumSelect({ name, entries, defaultValue }: { name: string; entries: Record, defaultValue?: string }): JSX.Element { return ( - + {Object.entries(entries).map(([v, name]) => )} ); } diff --git a/src/components/task-row.tsx b/src/components/task-row.tsx index d220a91..0106306 100644 --- a/src/components/task-row.tsx +++ b/src/components/task-row.tsx @@ -2,43 +2,53 @@ import { useState } from 'react' import { taskTypes, taskStatuses } from './consts'; import { EnumSelect } from './enum-select'; -export function TaskRow({ task, updateTask }: { task: TodoTask, updateTask: (task: TodoTask) => void }): JSX.Element { +export function TaskRow({ task }: { task: TodoTask, updateTask: (task: TodoTask) => void }): JSX.Element { const [edit, setEdit] = useState(false); - return edit ? ( - - {} - - {} - - - - - - ) : ( - - {taskTypes[task.type]} - {task.title} - {taskStatuses[task.status]} - - - - - ) + return ( +
+
+ {edit + ? + : taskTypes[task.type] + } +
+
+ {edit + ? + : task.title} +
+
+ {edit + ? + : taskStatuses[task.status] + } +
+
+ {edit ? <> + + + : <> + + + } +
+
+ ); } \ No newline at end of file diff --git a/src/components/task-table.tsx b/src/components/task-table.tsx index 7eb4625..fdf3db5 100644 --- a/src/components/task-table.tsx +++ b/src/components/task-table.tsx @@ -3,19 +3,15 @@ import { TaskRow } from './task-row'; export function TaskTable({ tasks }: { tasks: TodoTasks }): JSX.Element { return ( - - - - - - - - - - - {tasks.map(task => { }} />)} - -
TipasPavadinimasStatusasVeiksmai
+
+
+
Tipas
+
Pavadinimas
+
Statusas
+
Veiksmai
+
+ {tasks.map(task => { }} />)} +
); } diff --git a/src/index.css b/src/index.css index c116d68..bcd754c 100644 --- a/src/index.css +++ b/src/index.css @@ -3,6 +3,7 @@ @tailwind utilities; @layer utilities { + p, li { @apply my-4; @@ -12,15 +13,44 @@ @apply bg-neutral-100 dark:bg-neutral-900 cursor-pointer px-5 py-2 rounded-lg border border-gray-300 hover:border-indigo-500 transition-colors duration-700; } - th { - @apply border-b dark:border-slate-600 pl-8 pt-0 pb-3 text-slate-400 dark:text-slate-200 text-left; + .tr { + @apply flex border-b pb-3 border-slate-100 dark:border-slate-700 text-slate-500 dark:text-slate-400; + + .td { + @apply pl-4 pt-4 content-center; + } + + .td:nth-child(1) { + @apply flex-auto w-32; + } + + .td:nth-child(2) { + @apply flex-auto w-64; + } + + .td:nth-child(3) { + @apply flex-auto w-32; + } + + .td:nth-child(4) { + @apply flex-auto w-16 flex justify-center; + } } - td { - @apply border-b border-slate-100 dark:border-slate-700 p-4 pr-0 text-slate-500 dark:text-slate-400; + .tr:first-child { + @apply dark:border-slate-600 text-slate-400 dark:text-slate-200; + + .td { + @apply pt-0; + } } - select, input { + .tr:last-child { + @apply pb-0 border-b-0; + } + + select, + input { @apply h-14 w-full rounded-lg border-0 px-3 py-4 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-indigo-500 focus:outline-none hover:ring-indigo-500 transition-shadow duration-700; } @@ -32,7 +62,8 @@ @apply rounded-t-xl; } - .accordion-title:last-child, .accordion-body:last-child { + .accordion-title:last-child, + .accordion-body:last-child { @apply border-b rounded-b-xl; }