2019-08-09 10:17:04 +00:00
import DialogContentText from "@material-ui/core/DialogContentText" ;
import React from "react" ;
2019-08-16 11:47:30 +00:00
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
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 ( {
defaultMessage : "Remove attribute value" ,
description : "dialog title" ,
id : "attributeValueDeleteDialogTitle"
} ) }
>
< DialogContentText >
{ useName ? (
< FormattedMessage
defaultMessage = 'Are you sure you want to remove "{ name }" value? If you remove it you won’ t be able to assign it to any of the products with "{ attributeName }" attribute.'
id = "attributeValueDeleteDialogContentWithAttributeName"
values = { {
2019-08-09 10:17:04 +00:00
attributeName ,
name
2019-08-16 11:47:30 +00:00
} }
/ >
) : (
< FormattedMessage
defaultMessage = 'Are you sure you want to remove "{ name }" value?'
description = "remove attribute value"
id = "attributeValueDeleteDialogContentWithoutAttributeName"
values = { {
name
} }
/ >
) }
< / DialogContentText >
< / ActionDialog >
) ;
} ;
2019-08-09 10:17:04 +00:00
AttributeValueDeleteDialog . displayName = "AttributeValueDeleteDialog" ;
export default AttributeValueDeleteDialog ;