saleor-dashboard/src/components/ErrorNoticeBar/ErrorNoticeBar.tsx
JanChodorowski 25f7c8e4d8
Preorders (#1426)
* Feed preorder data to product variant forms

* Add end preorder date input and handle date data

* Translate strings, refactor date parsing

* Fix snapshots

* CR response

* CR response

* CR response

* Fix negative threshold, product variant preorder toggle, product variant update, and simple product creation

* Make preorder data optional

* Prevent setting past date as preorder end

* Disable replacing preorder variant in order

* Adjust fulfill view to preorder in variant

* CR response + prevent subbmiting form when endPreorderDate is in the past and display warning

* Add ErrorNoticeBar

* Translate preorder end date in past error message, fix form submissison disabling logic

* Rebase fixes

* Fix preorder form disabling logic, remove isPreorder field

* Fix edge cases aroud preorder inputs

* Update storyshots
2021-10-01 14:41:31 +02:00

34 lines
839 B
TypeScript

import { Card, CardContent, Typography } from "@material-ui/core";
import { makeStyles } from "@saleor/macaw-ui";
import classNames from "classnames";
import React from "react";
interface ErrorNoticeBarProps {
className?: string;
message: string | React.ReactNode;
}
const useStyles = makeStyles(
theme => ({
root: {
background: theme.palette.alert.paper.error
}
}),
{
name: "ErrorNoticeBar"
}
);
const ErrorNoticeBar: React.FC<ErrorNoticeBarProps> = props => {
const { className, message } = props;
const classes = useStyles(props);
return (
<Card className={classNames(classes.root, className)}>
<CardContent>
<Typography variant="body1">{message}</Typography>
</CardContent>
</Card>
);
};
ErrorNoticeBar.displayName = "ErrorNoticeBar";
export default ErrorNoticeBar;