From c2daa0b5a449a97db957a47fd38fde4b50be9839 Mon Sep 17 00:00:00 2001 From: oliviareichl Date: Tue, 28 May 2024 14:06:38 +0200 Subject: [PATCH 1/4] chore: add all relevant columns to the search-results table --- components/search-data-table/data-table.vue | 40 +++++++++++++++++++++ pages/search.vue | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/components/search-data-table/data-table.vue b/components/search-data-table/data-table.vue index 20d975f..65e5a03 100644 --- a/components/search-data-table/data-table.vue +++ b/components/search-data-table/data-table.vue @@ -23,6 +23,46 @@ const columns: Array> = [ return h("div", row.getValue("title")); }, }, + { + accessorKey: "work_type", + header: () => h("div", "Typ"), + cell: ({ row }) => { + const workType = row.getValue("work_type"); + return h("div", {}, workType.map((type) => type.name).join(", ")); + }, + }, + { + accessorKey: "expression_data", + header: () => h("div", "Edition"), + cell: ({ row }) => { + const edition = row.getValue("expression_data"); + return h("div", {}, edition.map((type) => type.edition).join(", ")); + }, + }, + { + accessorKey: "expression_data", + header: () => h("div", "Ort"), + cell: ({ row }) => { + const placeOfPublication = row.getValue("expression_data"); + return h("div", {}, placeOfPublication.map((type) => type.place_of_publication).join(", ")); + }, + }, + { + accessorKey: "expression_data", + header: () => h("div", "Verlag"), + cell: ({ row }) => { + const publisher = row.getValue("expression_data"); + return h("div", {}, publisher.map((type) => type.publisher).join(", ")); + }, + }, + { + accessorKey: "expression_data", + header: () => h("div", "Veröffentlichungsdatum"), + cell: ({ row }) => { + const publicationDate = row.getValue("expression_data"); + return h("div", {}, publicationDate.map((type) => type.publication_date).join(", ")); + }, + }, ]; const table = useVueTable({ diff --git a/pages/search.vue b/pages/search.vue index 71fca5d..84a2419 100644 --- a/pages/search.vue +++ b/pages/search.vue @@ -14,7 +14,7 @@ const { data, isFetching } = useQuery({ queryKey: ["worklist"] as const, async queryFn() { return $api.api_work_preview_list({ - queries: { limit: 10, offset: 0 }, + queries: { limit: 20, offset: 0 }, }); }, }); From b27c3e455b68d121137436baf59bfad2c000eaf6 Mon Sep 17 00:00:00 2001 From: oliviareichl Date: Fri, 14 Jun 2024 16:41:02 +0200 Subject: [PATCH 2/4] feat: pagination and search / filtering ui --- components/search-data-table/data-table.vue | 90 +++++++------- components/search-filter.vue | 113 ++++++++++++++++++ components/search-form.vue | 57 +++++++++ components/ui/button/index.ts | 7 +- components/ui/checkbox/Checkbox.vue | 42 +++++++ components/ui/checkbox/index.ts | 1 + components/ui/input/Input.vue | 33 +++++ components/ui/input/index.ts | 1 + .../ui/pagination/PaginationEllipsis.vue | 2 +- components/ui/pagination/PaginationFirst.vue | 2 +- components/ui/pagination/PaginationLast.vue | 2 +- components/ui/pagination/PaginationNext.vue | 2 +- components/ui/pagination/PaginationPrev.vue | 2 +- components/ui/slider/Slider.vue | 41 +++++++ components/ui/slider/index.ts | 1 + composables/use-get-search-results.ts | 20 ++++ package.json | 2 +- pages/search.vue | 90 +++++++++++--- tailwind.config.ts | 3 +- 19 files changed, 441 insertions(+), 70 deletions(-) create mode 100644 components/search-filter.vue create mode 100644 components/search-form.vue create mode 100644 components/ui/checkbox/Checkbox.vue create mode 100644 components/ui/checkbox/index.ts create mode 100644 components/ui/input/Input.vue create mode 100644 components/ui/input/index.ts create mode 100644 components/ui/slider/Slider.vue create mode 100644 components/ui/slider/index.ts create mode 100644 composables/use-get-search-results.ts diff --git a/components/search-data-table/data-table.vue b/components/search-data-table/data-table.vue index 65e5a03..e204ee2 100644 --- a/components/search-data-table/data-table.vue +++ b/components/search-data-table/data-table.vue @@ -13,16 +13,10 @@ import type { SearchResults } from "@/types/api.ts"; const props = defineProps<{ data: SearchResults["results"]; + resultsTotal: number; }>(); const columns: Array> = [ - { - accessorKey: "title", - header: () => h("div", "Titel"), - cell: ({ row }) => { - return h("div", row.getValue("title")); - }, - }, { accessorKey: "work_type", header: () => h("div", "Typ"), @@ -31,6 +25,13 @@ const columns: Array> = [ return h("div", {}, workType.map((type) => type.name).join(", ")); }, }, + { + accessorKey: "title", + header: () => h("div", "Titel"), + cell: ({ row }) => { + return h("div", row.getValue("title")); + }, + }, { accessorKey: "expression_data", header: () => h("div", "Edition"), @@ -77,43 +78,44 @@ const table = useVueTable({ diff --git a/components/search-filter.vue b/components/search-filter.vue new file mode 100644 index 0000000..c55928a --- /dev/null +++ b/components/search-filter.vue @@ -0,0 +1,113 @@ + + + diff --git a/components/search-form.vue b/components/search-form.vue new file mode 100644 index 0000000..ca8decb --- /dev/null +++ b/components/search-form.vue @@ -0,0 +1,57 @@ + + + diff --git a/components/ui/button/index.ts b/components/ui/button/index.ts index ec2a644..8967808 100644 --- a/components/ui/button/index.ts +++ b/components/ui/button/index.ts @@ -3,7 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority"; export { default as Button } from "./Button.vue"; export const buttonVariants = cva( - "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", + "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", { variants: { variant: { @@ -14,6 +14,10 @@ export const buttonVariants = cva( secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80", ghost: "hover:bg-accent hover:text-accent-foreground", link: "text-primary underline-offset-4 hover:underline", + searchform: + "items-end justify-end bg-none text-lg font-bold text-frisch-orange hover:text-frisch-indigo", + pagination: "bg-frisch-indigo text-lg text-white hover:bg-frisch-indigo/90", + paginationActive: "bg-frisch-orange text-lg text-white", }, size: { default: "h-9 px-4 py-2", @@ -21,6 +25,7 @@ export const buttonVariants = cva( sm: "h-8 rounded-md px-3 text-xs", lg: "h-10 rounded-md px-8", icon: "size-9", + searchform: "h-9", }, }, defaultVariants: { diff --git a/components/ui/checkbox/Checkbox.vue b/components/ui/checkbox/Checkbox.vue new file mode 100644 index 0000000..5c04b82 --- /dev/null +++ b/components/ui/checkbox/Checkbox.vue @@ -0,0 +1,42 @@ + + + diff --git a/components/ui/checkbox/index.ts b/components/ui/checkbox/index.ts new file mode 100644 index 0000000..75be342 --- /dev/null +++ b/components/ui/checkbox/index.ts @@ -0,0 +1 @@ +export { default as Checkbox } from "./Checkbox.vue"; diff --git a/components/ui/input/Input.vue b/components/ui/input/Input.vue new file mode 100644 index 0000000..b46a49e --- /dev/null +++ b/components/ui/input/Input.vue @@ -0,0 +1,33 @@ + + + diff --git a/components/ui/input/index.ts b/components/ui/input/index.ts new file mode 100644 index 0000000..110f046 --- /dev/null +++ b/components/ui/input/index.ts @@ -0,0 +1 @@ +export { default as Input } from "./Input.vue"; diff --git a/components/ui/pagination/PaginationEllipsis.vue b/components/ui/pagination/PaginationEllipsis.vue index 2e32dbf..dea8c94 100644 --- a/components/ui/pagination/PaginationEllipsis.vue +++ b/components/ui/pagination/PaginationEllipsis.vue @@ -20,7 +20,7 @@ const delegatedProps = computed(() => { :class="cn('w-9 h-9 flex items-center justify-center', props.class)" > - + diff --git a/components/ui/pagination/PaginationFirst.vue b/components/ui/pagination/PaginationFirst.vue index f32fe83..50b83b9 100644 --- a/components/ui/pagination/PaginationFirst.vue +++ b/components/ui/pagination/PaginationFirst.vue @@ -22,7 +22,7 @@ const delegatedProps = computed(() => {