saleor-dashboard/src/attributes/components/AttributeValueDeleteDialog/AttributeValueDeleteDialog.tsx

66 lines
1.8 KiB
TypeScript
Raw Normal View History

2019-08-09 10:17:04 +00:00
import DialogContentText from "@material-ui/core/DialogContentText";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
2019-08-09 10:17:04 +00:00
import ActionDialog from "@saleor/components/ActionDialog";
import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton";
export interface AttributeValueDeleteDialogProps {
attributeName: string;
confirmButtonState: ConfirmButtonTransitionState;
open: boolean;
name: string;
useName?: boolean;
onConfirm: () => void;
onClose: () => void;
}
const AttributeValueDeleteDialog: React.FC<AttributeValueDeleteDialogProps> = ({
attributeName,
name,
confirmButtonState,
useName,
onClose,
onConfirm,
open
}) => {
const intl = useIntl();
return (
<ActionDialog
open={open}
onClose={onClose}
confirmButtonState={confirmButtonState}
onConfirm={onConfirm}
variant="delete"
title={intl.formatMessage({
2019-08-20 10:05:08 +00:00
defaultMessage: "Delete attribute value",
2019-08-22 16:25:55 +00:00
description: "dialog title"
})}
>
<DialogContentText>
{useName ? (
<FormattedMessage
2019-08-20 10:51:18 +00:00
defaultMessage='Are you sure you want to delete "{ name }" value? If you delete it you wont be able to assign it to any of the products with "{ attributeName }" attribute.'
values={{
2019-08-09 10:17:04 +00:00
attributeName,
name
}}
/>
) : (
<FormattedMessage
2019-08-20 10:05:08 +00:00
defaultMessage='Are you sure you want to delete "{ name }" value?'
description="delete attribute value"
values={{
name
}}
/>
)}
</DialogContentText>
</ActionDialog>
);
};
2019-08-09 10:17:04 +00:00
AttributeValueDeleteDialog.displayName = "AttributeValueDeleteDialog";
export default AttributeValueDeleteDialog;