make filter more intuitive, usable on mobile
Gitea/subman-nextjs/pipeline/head This commit looks good Details

This commit is contained in:
andrzej 2024-10-12 18:23:04 +02:00
parent 01b98a0a08
commit 59a8f8bc41
2 changed files with 22 additions and 19 deletions

View File

@ -745,6 +745,11 @@ body {
margin-bottom: auto; margin-bottom: auto;
} }
.mx-0 {
margin-left: 0px;
margin-right: 0px;
}
.mb-6 { .mb-6 {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
} }
@ -769,10 +774,6 @@ body {
margin-top: 0.5rem; margin-top: 0.5rem;
} }
.mt-20 {
margin-top: 5rem;
}
.mt-3 { .mt-3 {
margin-top: 0.75rem; margin-top: 0.75rem;
} }
@ -1117,6 +1118,10 @@ body {
align-items: baseline; align-items: baseline;
} }
.justify-start {
justify-content: flex-start;
}
.justify-end { .justify-end {
justify-content: flex-end; justify-content: flex-end;
} }
@ -1145,6 +1150,14 @@ body {
gap: 1rem; gap: 1rem;
} }
.gap-0 {
gap: 0px;
}
.gap-0\.5 {
gap: 0.125rem;
}
.gap-x-16 { .gap-x-16 {
-moz-column-gap: 4rem; -moz-column-gap: 4rem;
column-gap: 4rem; column-gap: 4rem;
@ -1364,11 +1377,6 @@ body {
background-color: transparent; background-color: transparent;
} }
.bg-white {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
}
.fill-current { .fill-current {
fill: currentColor; fill: currentColor;
} }
@ -1675,10 +1683,6 @@ body {
outline-style: solid; outline-style: solid;
} }
.ring-primary {
--tw-ring-color: hsl(var(--primary));
}
.ring-offset-background { .ring-offset-background {
--tw-ring-offset-color: hsl(var(--background)); --tw-ring-offset-color: hsl(var(--background));
} }

View File

@ -38,7 +38,7 @@ import {
TableHeader, TableHeader,
TableRow, TableRow,
} from "@/components/ui/table" } from "@/components/ui/table"
import { EyeIcon, Trash2 } from "lucide-react" import { CircleHelp, EyeIcon, Trash2 } from "lucide-react"
import { usePathname, useSearchParams } from "next/navigation" import { usePathname, useSearchParams } from "next/navigation"
import FormContextMenu from "./contextMenu" import FormContextMenu from "./contextMenu"
import { deleteRecord, deleteRecords } from "app/lib/del" import { deleteRecord, deleteRecords } from "app/lib/del"
@ -132,13 +132,11 @@ export function DataTable<TData, TValue>({
const [filterBy, setFilterBy] = useState(table.getAllColumns()[0]) const [filterBy, setFilterBy] = useState(table.getAllColumns()[0])
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false) const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
return (<> return (<>
<div className="flex justify-between items-center py-1 md:py-4"> <div className="flex gap-1 justify-between items-center py-1 md:py-4">
<div className="flex gap-2"> <div className="flex gap-0.5">
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button variant="outline" className="hidden sm:block ml-auto"> <Button variant="outline" className="mx-0"> <p className="hidden md:block">Filter by</p><CircleHelp className="block md:hidden" /> </Button>
Filter by
</Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end"> <DropdownMenuContent align="end">
{/*@ts-ignore*/} {/*@ts-ignore*/}
@ -157,6 +155,7 @@ export function DataTable<TData, TValue>({
onChange={(event) => onChange={(event) =>
table.getColumn(filterBy.id)?.setFilterValue(event.target.value) table.getColumn(filterBy.id)?.setFilterValue(event.target.value)
} }
disabled={filterBy.id === "select"}
className="max-w-sm" className="max-w-sm"
/> />
</div> </div>