Skip to content

Commit

Permalink
linting data-table
Browse files Browse the repository at this point in the history
  • Loading branch information
buckhalt committed Feb 2, 2024
1 parent 482cd11 commit bb1eb16
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
11 changes: 6 additions & 5 deletions components/data-table/advanced/data-table-multi-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Separator } from '~/components/ui/separator';
import { DataTableFacetedFilter } from '../data-table-faceted-filter';
import { type DataTableFilterOption } from '~/lib/data-table/types';
import { AlignCenter, Copy, MoreHorizontal, Trash } from 'lucide-react';
import { type Route } from 'next';

const operators = [
{
Expand All @@ -48,7 +49,7 @@ type DataTableMultiFilterProps<TData> = {
setSelectedOptions: React.Dispatch<
React.SetStateAction<DataTableFilterOption<TData>[]>
>;
}
};

export function DataTableMultiFilter<TData>({
table,
Expand Down Expand Up @@ -115,7 +116,7 @@ type MultiFilterRowProps<TData> = {
setOperator: React.Dispatch<
React.SetStateAction<(typeof operators)[number] | undefined>
>;
} & DataTableMultiFilterProps<TData>
} & DataTableMultiFilterProps<TData>;

export function MultiFilterRow<TData>({
i,
Expand Down Expand Up @@ -176,7 +177,7 @@ export function MultiFilterRow<TData>({
[selectedOption?.value ?? '']: `${debounceValue}${
debounceValue.length > 0 ? `.${filterVariety}` : ''
}`,
})}`,
})}` as Route,
{
scroll: false,
},
Expand All @@ -187,7 +188,7 @@ export function MultiFilterRow<TData>({
router.push(
`${pathname}?${createQueryString({
[selectedOption?.value ?? '']: null,
})}`,
})}` as Route,
{
scroll: false,
},
Expand All @@ -202,7 +203,7 @@ export function MultiFilterRow<TData>({
router.push(
`${pathname}?${createQueryString({
operator: operator.value,
})}`,
})}` as Route,
{
scroll: false,
},
Expand Down
5 changes: 2 additions & 3 deletions components/data-table/data-table-faceted-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type DataTableFacetedFilter<TData, TValue> = {
title?: string;
options: Option[];
variant?: 'popover' | 'command';
}
};

export function DataTableFacetedFilter<TData, TValue>({
column,
Expand Down Expand Up @@ -144,8 +144,7 @@ export function DataTableFacetedFilter<TData, TValue>({
<CommandInput
placeholder={title}
autoFocus
showIcon={false}
className="border-input file:bg-transparent focus-visible:ring-ring flex h-8 w-full rounded-md border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50"
className="flex h-8 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
/>
<CommandList className="mt-1">
<CommandEmpty>No results found.</CommandEmpty>
Expand Down
5 changes: 3 additions & 2 deletions components/data-table/data-table-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import {
} from '~/lib/data-table/types';
import { Cross, PlusCircle, Trash } from 'lucide-react';
import { cn } from '~/utils/shadcn';
import { type UrlObject } from 'url';

type DataTableToolbarProps<TData> = {
table: Table<TData>;
filterableColumns?: DataTableFilterableColumn<TData>[];
searchableColumns?: DataTableSearchableColumn<TData>[];
newRowLink?: string;
newRowLink?: UrlObject;
deleteRowsAction?: React.MouseEventHandler<HTMLButtonElement>;
}
};

export function DataTableToolbar<TData>({
table,
Expand Down

0 comments on commit bb1eb16

Please sign in to comment.