From 2b4be68a5d956a514eab4253784181a632046b19 Mon Sep 17 00:00:00 2001 From: Oliver Bryan <04oliverbryan@gmail.com> Date: Sat, 13 Dec 2025 18:55:07 +0000 Subject: [PATCH] added link functionality to button --- src/components/ui/button.tsx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 0113197..007dfcf 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -3,6 +3,7 @@ import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; +import { Link } from "react-router-dom"; const buttonVariants = cva( "cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", @@ -39,21 +40,37 @@ function Button({ variant = "default", size = "default", asChild = false, + linkTo, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean; + linkTo?: string; }) { const Comp = asChild ? Slot : "button"; return ( - + <> + {linkTo ? ( + + + + ) : ( + + )} + ); }