From e67f4e5f29c7232bad563fb30bfd17962ad7dc8b Mon Sep 17 00:00:00 2001 From: Pablo Lara Date: Wed, 25 Sep 2024 06:56:34 +0200 Subject: [PATCH] feat: WIP --- components/filters/CustomSearchInput.tsx | 9 +- components/icons/Icons.tsx | 83 ++++++++++++++ .../table/data-table-column-header.tsx | 17 ++- .../table/data-table-filter-custom.tsx | 103 +++++++++++++++--- .../providers/table/data-table-provider.tsx | 32 +++++- components/ui/table/Table.tsx | 33 +++--- tailwind.config.js | 66 +++++++++++ 7 files changed, 298 insertions(+), 45 deletions(-) diff --git a/components/filters/CustomSearchInput.tsx b/components/filters/CustomSearchInput.tsx index 98310f10b5..09fb786e39 100644 --- a/components/filters/CustomSearchInput.tsx +++ b/components/filters/CustomSearchInput.tsx @@ -1,6 +1,6 @@ import { Input } from "@nextui-org/react"; import debounce from "lodash.debounce"; -import { XCircle } from "lucide-react"; +import { SearchIcon, XCircle } from "lucide-react"; import { useRouter, useSearchParams } from "next/navigation"; import React, { useCallback, useEffect, useState } from "react"; @@ -39,9 +39,9 @@ export const CustomSearchInput: React.FC = () => { } onChange={(e) => { const value = e.target.value; setSearchQuery(value); @@ -54,7 +54,8 @@ export const CustomSearchInput: React.FC = () => { ) } - size="sm" + radius="full" + size="lg" /> ); }; diff --git a/components/icons/Icons.tsx b/components/icons/Icons.tsx index f665b49628..c6383a2af2 100644 --- a/components/icons/Icons.tsx +++ b/components/icons/Icons.tsx @@ -595,3 +595,86 @@ export const SuccessIcon: React.FC = ({ /> ); + +export const ArrowUpIcon: React.FC = ({ + size, + height, + width, + ...props +}) => { + return ( + + ); +}; + +export const ArrowDownIcon: React.FC = ({ + size, + height, + width, + ...props +}) => { + return ( + + ); +}; + +export const ChevronsLeftRightIcon: React.FC = ({ + size, + height, + width, + ...props +}) => { + return ( + + + + ); +}; diff --git a/components/providers/table/data-table-column-header.tsx b/components/providers/table/data-table-column-header.tsx index 3b460ae937..4df6af2d78 100644 --- a/components/providers/table/data-table-column-header.tsx +++ b/components/providers/table/data-table-column-header.tsx @@ -2,13 +2,14 @@ import { Button } from "@nextui-org/react"; import { Column } from "@tanstack/react-table"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; +import { HTMLAttributes } from "react"; + import { ArrowDownIcon, ArrowUpIcon, ChevronsLeftRightIcon, -} from "lucide-react"; -import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import { HTMLAttributes } from "react"; +} from "@/components/icons"; interface DataTableColumnHeaderProps extends HTMLAttributes { @@ -64,12 +65,12 @@ export const DataTableColumnHeader = ({ currentSortParam === "" || (currentSortParam !== param && currentSortParam !== `-${param}`) ) { - return ; + return ; } return currentSortParam === `-${param}` ? ( - + ) : ( - + ); }; @@ -79,9 +80,7 @@ export const DataTableColumnHeader = ({ return ( - )), - )} - + <> + {/*
+
+
+ + } + placeholder="Search" + size="sm" + // value={filterValue} + // onValueChange={onSearchChange} + /> +
+
+ + + + + +
+ + All + Employee + Contractor + + + + All + Active + Inactive + Paused + Vacation + + + + All + Last 7 days + Last 30 days + Last 60 days + +
+
+
+
+
+
*/} + +
+ {filters.flatMap(({ key, values }) => + values.map((value) => ( + + )), + )} +
+ ); } diff --git a/components/providers/table/data-table-provider.tsx b/components/providers/table/data-table-provider.tsx index e300496913..6ea0133cb4 100644 --- a/components/providers/table/data-table-provider.tsx +++ b/components/providers/table/data-table-provider.tsx @@ -1,5 +1,6 @@ "use client"; - +import { Icon } from "@iconify/react"; +import { Button, Chip } from "@nextui-org/react"; import { ColumnDef, ColumnFiltersState, @@ -11,7 +12,7 @@ import { SortingState, useReactTable, } from "@tanstack/react-table"; -import { useState } from "react"; +import { useMemo, useState } from "react"; import { Table, @@ -64,11 +65,36 @@ export function DataTableProvider({ { key: "connected", values: ["false", "true"] }, // Add more filter categories as needed ]; + const topBar = useMemo(() => { + return ( +
+
+

Providers

+ + 3 + +
+ +
+ ); + }, []); return ( <> + {topBar} + -
+ +
{table.getHeaderGroups().map((headerGroup) => ( diff --git a/components/ui/table/Table.tsx b/components/ui/table/Table.tsx index cdc1f5cfe6..91230d9f39 100644 --- a/components/ui/table/Table.tsx +++ b/components/ui/table/Table.tsx @@ -1,12 +1,11 @@ +import { cn } from "@nextui-org/react"; import * as React from "react"; -import { cn } from "@/lib/utils"; - const Table = React.forwardRef< HTMLTableElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( -
+
>(({ className, ...props }, ref) => ( - + tr]:first:rounded-lg [&>tr]:first:shadow-small", + className, + )} + {...props} + /> )); TableHeader.displayName = "TableHeader"; @@ -28,11 +34,7 @@ const TableBody = React.forwardRef< HTMLTableSectionElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( - + )); TableBody.displayName = "TableBody"; @@ -43,7 +45,7 @@ const TableFooter = React.forwardRef< tr]:last:border-b-0 dark:bg-slate-800/50", + "font-medium [&>tr]:last:border-b-0 dark:bg-slate-800/50", className, )} {...props} @@ -58,7 +60,7 @@ const TableRow = React.forwardRef< (({ className, ...props }, ref) => (
)); @@ -99,7 +104,7 @@ const TableCaption = React.forwardRef< >(({ className, ...props }, ref) => (
)); diff --git a/tailwind.config.js b/tailwind.config.js index 47d4df9ac4..18cf88a602 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -19,6 +19,31 @@ module.exports = { }, extend: { colors: { + prowler: { + blue: { + midnight: "#030921", + pale: "#f3fcff", + }, + grey: { + medium: "#353a4d", + light: "#868994", + }, + theme: { + green: "#6af400", + purple: "#5001d0", + coral: "#ff5356", + orange: "#f69000", + yellow: "#ffdf16", + }, + dark: { + title: "#E2E8F0", + text: "#94a3b8" /* primary default for dark mode */, + }, + light: { + title: "#1e293bff", + text: "#64748b" /* primary default for light mode */, + }, + }, system: { success: { DEFAULT: "#09BF3D", @@ -56,6 +81,47 @@ module.exports = { sans: ["var(--font-sans)"], mono: ["var(--font-geist-mono)"], }, + boxShadow: { + "box-light": + "-16px -16px 40px rgba(255, 255, 255, 0.8), 16px 4px 64px rgba(18, 61, 101, 0.3), inset -8px -6px 80px rgba(255, 255, 255, 0.18)", + "button-curved-default": + "-4px -2px 16px rgba(255, 255, 255, 0.7), 4px 2px 16px rgba(136, 165, 191, 0.38)", + "button-curved-pressed": + "inset -4px -4px 16px rgba(255, 255, 255, 0.8), inset 4px 4px 12px rgba(136, 165, 191, 0.4)", + "button-flat-nopressed": + "-4px -2px 16px #FFFFFF, 4px 2px 16px rgba(136, 165, 191, 0.48)", + "button-flat-pressed": + "inset -3px -3px 7px #FFFFFF, inset 3px 3px 7px rgba(136, 165, 191, 0.48)", + "box-down-light": + "inset -3px -3px 7px #FFFFFF, inset 2px 2px 5px rgba(136, 165, 191, 0.38)", + "box-up": + "-4px -2px 16px #FFFFFF, 4px 2px 16px rgba(136, 165, 191, 0.54)", + "box-dark": + "-4px -2px 16px rgba(195, 200, 205, 0.09), 4px 4px 18px rgba(0, 0, 0, 0.5)", + "box-dark-out": "inset 2px 2px 2px rgba(26, 32, 38, 0.4)", + "buttons-box-dark": + "-5px -6px 16px rgba(195, 200, 205, 0.04), 22px 22px 60px rgba(0, 0, 0, 0.5)", + "button-curved-default-dark": + "-4px -4px 16px rgba(195, 200, 205, 0.06), 4px 4px 18px rgba(0, 0, 0, 0.6)", + "button-curved-pressed-dark": + "-4px -2px 16px rgba(195, 200, 205, 0.07), 4px 4px 18px rgba(0, 0, 0, 0.44)", + "sky-light": + "-16px 20px 40px rgba(215, 215, 215, 0.3), -2px 2px 24px rgba(22, 28, 47, 0.3), -16px 28px 120px rgba(0, 0, 0, 0.1)", + "midnight-dark": + "-16px 20px 40px rgba(3, 9, 33, 0.3), -2px 2px 24px rgba(3, 9, 33, 0.6), -16px 28px 120px rgba(3, 9, 33, 0.1)", + switcher: + "0px -6px 24px #FFFFFF, 0px 7px 16px rgba(104, 132, 157, 0.5)", + up: "0.3rem 0.3rem 0.6rem #c8d0e7, -0.2rem -0.2rem 0.5rem #fff", + down: "inset 0.2rem 0.2rem 0.5rem #c8d0e7, inset -0.2rem -0.2rem 0.5rem #fff", + }, + animation: { + "fade-in": "fade-in 200ms ease-out 0s 1 normal forwards running", + "fade-out": "fade-out 200ms ease-in 0s 1 normal forwards running", + expand: "expand 400ms linear 0s 1 normal forwards running", + "slide-in": "slide-in 400ms linear 0s 1 normal forwards running", + "slide-out": "slide-out 400ms linear 0s 1 normal forwards running", + collapse: "collapse 400ms linear 0s 1 normal forwards running", + }, keyframes: { "accordion-down": { from: { height: "0" },