import { Button, ButtonProps } from "@/ui";
import { t } from "i18next";
import { PackagePlusIcon } from "lucide-react";
import { forwardRef } from "react";

export interface AppendCatalogArticleRowButtonProps extends ButtonProps {
  label?: string;
  className?: string;
}

export const AppendCatalogArticleRowButton = forwardRef<
  HTMLButtonElement,
  AppendCatalogArticleRowButtonProps
>(
  (
    { label = t("common.append_article"), className, ...props }: AppendCatalogArticleRowButtonProps,
    ref
  ): JSX.Element => (
    <Button type='button' variant='outline' ref={ref} {...props}>
      {" "}
      <PackagePlusIcon className={label ? "w-4 h-4 mr-2" : "w-4 h-4"} />
      {label && <>{label}</>}
    </Button>
  )
);

AppendCatalogArticleRowButton.displayName = "AppendCatalogArticleRowButton";
