Files
ERP_Distribution/distribution_fe/components/shared/row-actions.tsx
T
Kalana B. Thilakarathna 7b6c9ac92a
CI/CD - ERP Distribution / Build & Deploy Backend (pull_request) Failing after 10m33s
CI/CD - ERP Distribution / Build & Deploy Frontend (pull_request) Failing after 14m20s
feat: update row actions to include payment functionality and add corresponding icon
2026-10-19 22:12:40 +05:30

80 lines
1.6 KiB
TypeScript

"use client"
import * as React from "react"
import { HugeiconsIcon } from "@hugeicons/react"
import {
AddMoneyCircleIcon,
Cancel01Icon,
CheckmarkCircle02Icon,
CheckmarkSquare01Icon,
Delete02Icon,
EyeIcon,
PencilEdit01Icon,
PrinterIcon,
} from "@hugeicons/core-free-icons"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
const ACTION_ICONS = {
activate: CheckmarkCircle02Icon,
cancel: Delete02Icon,
close: Cancel01Icon,
confirm: CheckmarkCircle02Icon,
deactivate: Cancel01Icon,
edit: PencilEdit01Icon,
finalize: CheckmarkSquare01Icon,
generate: CheckmarkSquare01Icon,
pay: AddMoneyCircleIcon,
print: PrinterIcon,
view: EyeIcon,
} as const
type RowActionKind = keyof typeof ACTION_ICONS
function RowActions({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
className={cn("flex items-center justify-end gap-1", className)}
{...props}
/>
)
}
function RowActionButton({
action,
label,
tone = "default",
className,
...props
}: Omit<React.ComponentProps<typeof Button>, "children"> & {
action: RowActionKind
label: string
tone?: "default" | "destructive"
}) {
const icon = ACTION_ICONS[action]
return (
<Button
variant="ghost"
size="icon-sm"
className={cn(
tone === "destructive"
? "text-destructive hover:text-destructive"
: "text-muted-foreground hover:text-foreground",
className
)}
aria-label={label}
title={label}
{...props}
>
<HugeiconsIcon icon={icon} size={16} />
</Button>
)
}
export { RowActions, RowActionButton }