43 lines
941 B
TypeScript
43 lines
941 B
TypeScript
![]() |
import { Typography } from "@material-ui/core";
|
||
|
import { Alert } from "@saleor/macaw-ui";
|
||
|
import React from "react";
|
||
|
import { FormattedMessage, useIntl } from "react-intl";
|
||
|
|
||
|
import msgs from "./messages";
|
||
|
import { useStyles } from "./styles";
|
||
|
|
||
|
interface MarketplaceAlertProps {
|
||
|
error?: Error;
|
||
|
}
|
||
|
|
||
|
export const MarketplaceAlert: React.FC<MarketplaceAlertProps> = ({
|
||
|
error,
|
||
|
}) => {
|
||
|
const classes = useStyles();
|
||
|
const intl = useIntl();
|
||
|
|
||
|
if (!error) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<Alert
|
||
|
variant="warning"
|
||
|
className={classes.alert}
|
||
|
close={true}
|
||
|
title={intl.formatMessage(msgs.marketplaceError)}
|
||
|
>
|
||
|
<Typography>
|
||
|
<FormattedMessage
|
||
|
{...msgs.marketplaceErrorMessage}
|
||
|
values={{
|
||
|
message: <b>{error.message}</b>,
|
||
|
}}
|
||
|
/>
|
||
|
</Typography>
|
||
|
</Alert>
|
||
|
);
|
||
|
};
|
||
|
MarketplaceAlert.displayName = "MarketplaceAlert";
|
||
|
export default MarketplaceAlert;
|