2024-06-29 19:39:25 +00:00
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
|
import { Button, ButtonProps } from "@/ui";
|
2024-08-12 18:22:34 +00:00
|
|
|
import { t } from "i18next";
|
2024-06-29 19:39:25 +00:00
|
|
|
import { PlusCircleIcon } from "lucide-react";
|
|
|
|
|
|
2024-08-12 18:22:34 +00:00
|
|
|
export interface AppendEmptyRowButtonProps extends ButtonProps {
|
2024-06-29 19:39:25 +00:00
|
|
|
label?: string;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-12 18:22:34 +00:00
|
|
|
export const AppendEmptyRowButton = ({
|
|
|
|
|
label = t("common.append_empty_row"),
|
2024-06-29 19:39:25 +00:00
|
|
|
className,
|
|
|
|
|
...props
|
2024-08-12 18:22:34 +00:00
|
|
|
}: AppendEmptyRowButtonProps): JSX.Element => (
|
2024-06-29 19:39:25 +00:00
|
|
|
<Button
|
|
|
|
|
type='button'
|
|
|
|
|
variant='outline'
|
|
|
|
|
size='icon'
|
|
|
|
|
className={cn(
|
|
|
|
|
"w-full gap-1 border-dashed text-muted-foreground border-muted-foreground/50",
|
|
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
<PlusCircleIcon className={label ? "w-4 h-4 mr-2" : "w-4 h-4"} />
|
|
|
|
|
{label && <>{label}</>}
|
|
|
|
|
</Button>
|
|
|
|
|
);
|
|
|
|
|
|
2024-08-12 18:22:34 +00:00
|
|
|
AppendEmptyRowButton.displayName = "AddNewRowButton";
|