2025-03-12 11:22:32 +08:00
|
|
|
import { cn } from "@heroui/react"
|
2024-11-11 10:04:00 +08:00
|
|
|
import type { ReactNode } from "react"
|
2024-09-20 23:15:42 +08:00
|
|
|
|
|
|
|
|
interface CardProps {
|
2024-09-27 15:28:32 +08:00
|
|
|
children?: ReactNode
|
|
|
|
|
className?: string
|
2024-10-28 10:42:42 +08:00
|
|
|
type?: string
|
2024-09-27 15:28:32 +08:00
|
|
|
onClick?: () => void
|
2024-09-20 23:15:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Card = ({ children }: CardProps) => {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
2025-03-12 13:07:16 +08:00
|
|
|
className="dark:bg-white/[3%] dark:border-white/[6%] px-3 pt-3 pb-4 flex flex-col gap-2.5 border w-full rounded-lg bg-white/40 border-black/[6%]"
|
2024-09-20 23:15:42 +08:00
|
|
|
data-tauri-drag-region
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
2024-09-27 15:28:32 +08:00
|
|
|
)
|
|
|
|
|
}
|
2024-09-20 23:15:42 +08:00
|
|
|
|
|
|
|
|
const CardHeader = ({ children }: CardProps) => {
|
2024-11-11 10:04:00 +08:00
|
|
|
return (
|
|
|
|
|
<div className="flex items-center gap-1.5 tracking-wide">{children}</div>
|
|
|
|
|
)
|
2024-09-27 15:28:32 +08:00
|
|
|
}
|
2024-09-20 23:15:42 +08:00
|
|
|
|
2024-10-28 10:42:42 +08:00
|
|
|
const CardIcon = ({ children, type, className, ...rest }: CardProps) => {
|
2024-09-20 23:15:42 +08:00
|
|
|
return (
|
2024-11-11 10:04:00 +08:00
|
|
|
<div
|
2025-03-12 11:22:32 +08:00
|
|
|
className={cn(
|
2024-11-11 10:04:00 +08:00
|
|
|
"flex gap-1.5 items-center font-semibold",
|
|
|
|
|
type === "menu" &&
|
|
|
|
|
"transition cursor-pointer hover:bg-black/5 px-2 py-1 rounded-md active:scale-95",
|
|
|
|
|
className,
|
|
|
|
|
)}
|
|
|
|
|
{...rest}
|
|
|
|
|
>
|
2024-09-20 23:15:42 +08:00
|
|
|
{children}
|
|
|
|
|
</div>
|
2024-09-27 15:28:32 +08:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const CardTool = ({ children }: CardProps) => {
|
2024-11-11 10:04:00 +08:00
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-end flex-grow gap-2">
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
2024-09-27 15:28:32 +08:00
|
|
|
}
|
2024-09-20 23:15:42 +08:00
|
|
|
|
|
|
|
|
const CardBody = ({ children }: CardProps) => {
|
2024-11-11 10:04:00 +08:00
|
|
|
return (
|
2025-03-12 13:16:25 +08:00
|
|
|
<div className="w-full h-full text-sm tracking-wide text-zinc-800 dark:text-white">
|
2024-11-11 10:04:00 +08:00
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
2024-09-27 15:28:32 +08:00
|
|
|
}
|
2024-09-20 23:15:42 +08:00
|
|
|
|
2024-09-27 15:28:32 +08:00
|
|
|
export { Card, CardHeader, CardIcon, CardTool, CardBody }
|