31 lines
846 B
TypeScript
31 lines
846 B
TypeScript
import { FormDialog } from "@repo/shadcn-ui/components/form-dialog";
|
|
import type { ComponentProps } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { BrandForm } from "./brand-form";
|
|
|
|
export function BrandEditorDialog({
|
|
open,
|
|
onOpenChange,
|
|
...formProps
|
|
}: ComponentProps<typeof BrandForm> & {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
}) {
|
|
const { t } = useTranslation("assets");
|
|
return (
|
|
<FormDialog
|
|
cancelLabel={t("cancel")}
|
|
formActions
|
|
onOpenChange={onOpenChange}
|
|
open={open}
|
|
title={t(formProps.brand ? "brands.edit" : "brands.new")}
|
|
>
|
|
{formProps.quickCreate && (
|
|
<p className="text-sm text-muted-foreground">{t("brands.quickNotice")}</p>
|
|
)}
|
|
<BrandForm {...formProps} key={formProps.brand?.id ?? "new"} />
|
|
</FormDialog>
|
|
);
|
|
}
|