🎨 Update UI package (#1070)

Add new components and update various existing ones.
This commit is contained in:
Luke Vella 2024-03-25 15:28:24 +07:00 committed by GitHub
parent a4ffbee081
commit e6792a4283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 386 additions and 56 deletions

40
packages/ui/src/icon.tsx Normal file
View file

@ -0,0 +1,40 @@
"use client";
import { Slot } from "@radix-ui/react-slot";
import { cn } from "./lib/utils";
import { VariantProps, cva } from "class-variance-authority";
const iconVariants = cva("", {
variants: {
variant: {
default: "text-gray-500",
success: "text-green-500",
danger: "text-rose-500",
primary: "text-primary-200",
},
size: {
md: "w-4 h-4",
lg: "w-5 h-5",
},
},
defaultVariants: {
size: "md",
variant: "default",
},
});
export interface IconProps extends VariantProps<typeof iconVariants> {
children?: React.ReactNode;
}
export function Icon({ children, size, variant }: IconProps) {
return (
<Slot
className={cn(
iconVariants({ size, variant }),
"group-[.bg-primary]:text-primary-200 group",
)}
>
{children}
</Slot>
);
}