From 0655ac41ec69ee19e5e2e05b86e09f47e103549c Mon Sep 17 00:00:00 2001 From: George Desipris <73396808+desiprisg@users.noreply.github.com> Date: Tue, 1 Oct 2024 20:16:48 +0300 Subject: [PATCH] feat(dashboard): Workflow list primitives (#6599) --- .../src/components/primitives/badge.tsx | 29 ++++ .../src/components/primitives/button.tsx | 4 +- .../src/components/primitives/pagination.tsx | 105 +++++++++++++ .../src/components/primitives/step.tsx | 34 +++++ .../src/components/primitives/table.tsx | 66 +++++++++ .../src/components/primitives/tag.tsx | 28 ++++ apps/dashboard/src/index.css | 14 +- apps/dashboard/src/main.tsx | 5 +- apps/dashboard/src/routes/home.tsx | 17 --- apps/dashboard/src/routes/index.ts | 1 - apps/dashboard/src/routes/primitives.tsx | 138 ++++++++++++++++++ apps/dashboard/tailwind.config.js | 21 +++ 12 files changed, 439 insertions(+), 23 deletions(-) create mode 100644 apps/dashboard/src/components/primitives/badge.tsx create mode 100644 apps/dashboard/src/components/primitives/pagination.tsx create mode 100644 apps/dashboard/src/components/primitives/step.tsx create mode 100644 apps/dashboard/src/components/primitives/table.tsx create mode 100644 apps/dashboard/src/components/primitives/tag.tsx delete mode 100644 apps/dashboard/src/routes/home.tsx create mode 100644 apps/dashboard/src/routes/primitives.tsx diff --git a/apps/dashboard/src/components/primitives/badge.tsx b/apps/dashboard/src/components/primitives/badge.tsx new file mode 100644 index 00000000000..daf68db1eea --- /dev/null +++ b/apps/dashboard/src/components/primitives/badge.tsx @@ -0,0 +1,29 @@ +import * as React from 'react'; +import { cva, type VariantProps } from 'class-variance-authority'; + +import { cn } from '@/utils/ui'; + +const badgeVariants = cva( + 'inline-flex items-center rounded-md border px-2 py-1 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', + { + variants: { + variant: { + default: 'border-transparent bg-muted text-muted-foreground', + destructive: 'border-transparent bg-destructive/10 text-destructive', + success: 'border-transparent bg-success/10 text-success', + warning: 'border-transparent bg-warning/10 text-warning', + }, + }, + defaultVariants: { + variant: 'default', + }, + } +); + +export interface BadgeProps extends React.HTMLAttributes, VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return
; +} + +export { Badge, badgeVariants }; diff --git a/apps/dashboard/src/components/primitives/button.tsx b/apps/dashboard/src/components/primitives/button.tsx index ea7f6ea3425..e0154f479d5 100644 --- a/apps/dashboard/src/components/primitives/button.tsx +++ b/apps/dashboard/src/components/primitives/button.tsx @@ -19,9 +19,9 @@ const buttonVariants = cva( }, size: { default: 'h-9 p-2.5', - sm: 'h-8 rounded-md text-xs', + sm: 'h-8 px-3 rounded-md text-xs', lg: 'h-10 rounded-md px-8', - icon: 'h-9 w-9', + icon: 'size-8', }, }, defaultVariants: { diff --git a/apps/dashboard/src/components/primitives/pagination.tsx b/apps/dashboard/src/components/primitives/pagination.tsx new file mode 100644 index 00000000000..52a8476a442 --- /dev/null +++ b/apps/dashboard/src/components/primitives/pagination.tsx @@ -0,0 +1,105 @@ +import * as React from 'react'; +import { + ChevronLeftIcon, + ChevronRightIcon, + DotsHorizontalIcon, + DoubleArrowLeftIcon, + DoubleArrowRightIcon, +} from '@radix-ui/react-icons'; + +import { cn } from '@/utils/ui'; +import { ButtonProps, buttonVariants } from '@/components/primitives/button'; + +const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => ( +