2021-05-14 08:15:15 +00:00
import { DialogContentText } from "@material-ui/core" ;
2019-08-09 10:17:04 +00:00
import ActionDialog from "@saleor/components/ActionDialog" ;
import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton" ;
2020-05-14 09:30:32 +00:00
import React from "react" ;
import { FormattedMessage , useIntl } from "react-intl" ;
2019-08-09 10:17:04 +00:00
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
2019-08-16 11:47:30 +00:00
} ) = > {
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"
2019-08-16 11:47:30 +00:00
} ) }
>
< DialogContentText >
{ useName ? (
< FormattedMessage
2019-11-05 12:57:30 +00:00
defaultMessage = 'Are you sure you want to delete "{name}" value? If you delete it you won’ t be able to assign it to any of the products with "{attributeName}" attribute.'
2019-08-16 11:47:30 +00:00
values = { {
2019-08-09 10:17:04 +00:00
attributeName ,
name
2019-08-16 11:47:30 +00:00
} }
/ >
) : (
< FormattedMessage
2019-11-05 12:57:30 +00:00
defaultMessage = 'Are you sure you want to delete "{name}" value?'
2019-08-20 10:05:08 +00:00
description = "delete attribute value"
2019-08-16 11:47:30 +00:00
values = { {
name
} }
/ >
) }
< / DialogContentText >
< / ActionDialog >
) ;
} ;
2019-08-09 10:17:04 +00:00
AttributeValueDeleteDialog . displayName = "AttributeValueDeleteDialog" ;
export default AttributeValueDeleteDialog ;