完善资源列表查询行为,提供表格公共组件

This commit is contained in:
2025-04-10 17:49:02 +08:00
parent 74c6c01b7d
commit 7238166a95
15 changed files with 1057 additions and 28 deletions

View File

@@ -1,6 +1,6 @@
import * as React from 'react'
import {Slot} from '@radix-ui/react-slot'
import {merge} from '@/lib/utils'
import {cva} from 'class-variance-authority'
type ButtonProps = React.ComponentProps<'button'> & {
variant?: 'default' | 'outline' | 'gradient' | 'danger' | 'accent'
@@ -34,4 +34,34 @@ function Button(rawProps: ButtonProps) {
)
}
export {Button}
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
outline:
"border border-input bg-background shadow-sm hover:bg-secondary hover:text-secondary-foreground",
secondary:
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
ghost: "hover:bg-secondary hover:text-secondary-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8",
icon: "h-9 w-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
export {Button, buttonVariants}