5ec2ad0043
refactor(card): 调整卡片背景色和边框颜色 refactor(badge): 修改徽章颜色变体 refactor(button): 更新按钮颜色样式 refactor(input): 调整输入框颜色方案 refactor(textarea): 修改文本区域颜色样式 refactor(header): 更新导航栏颜色 refactor(hero-section): 调整英雄区域颜色和渐变
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import * as React from "react"
|
|
import { Slot } from "@radix-ui/react-slot"
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
const badgeVariants = cva(
|
|
"inline-flex items-center justify-center rounded-full border px-3 py-1 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-[#1C1C1C] focus-visible:ring-2 focus-visible:ring-[#1C1C1C]/50 transition-all duration-300 overflow-hidden",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "bg-[#C41E3A] text-white border-transparent shadow-sm",
|
|
secondary:
|
|
"bg-[#1C1C1C] text-white border-transparent shadow-sm",
|
|
destructive:
|
|
"bg-[#C41E3A] text-white border-transparent hover:bg-[#A01830]",
|
|
outline:
|
|
"border-[#1C1C1C] text-[#1C1C1C] bg-transparent hover:bg-[#F5F5F5]",
|
|
ghost: "text-[#5C5C5C] hover:text-[#1C1C1C] hover:bg-[#F5F5F5]",
|
|
success: "bg-[#16A34A] text-white border-transparent hover:bg-[#15803D]",
|
|
warning: "bg-[#D97706] text-white border-transparent hover:bg-[#B45309]",
|
|
info: "bg-[#5C5C5C] text-white border-transparent hover:bg-[#3D3D3D]",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
},
|
|
}
|
|
)
|
|
|
|
function Badge({
|
|
className,
|
|
variant = "default",
|
|
asChild = false,
|
|
...props
|
|
}: React.ComponentProps<"span"> &
|
|
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
const Comp = asChild ? Slot : "span"
|
|
|
|
return (
|
|
<Comp
|
|
data-slot="badge"
|
|
data-variant={variant}
|
|
className={cn(badgeVariants({ variant }), className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Badge, badgeVariants }
|