2019-10-30 14:34:24 +00:00
|
|
|
import { makeStyles } from "@material-ui/core/styles";
|
2019-06-19 14:40:52 +00:00
|
|
|
import Typography from "@material-ui/core/Typography";
|
2019-08-09 10:26:22 +00:00
|
|
|
import React from "react";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
import ExtendedPageHeader from "../ExtendedPageHeader";
|
|
|
|
import Skeleton from "../Skeleton";
|
|
|
|
|
2019-10-30 14:34:24 +00:00
|
|
|
const useStyles = makeStyles(theme => ({
|
|
|
|
root: {
|
|
|
|
display: "flex"
|
|
|
|
},
|
|
|
|
title: {
|
2019-11-04 19:31:23 +00:00
|
|
|
[theme.breakpoints.down("sm")]: {
|
|
|
|
fontSize: 20,
|
|
|
|
paddingBottom: 20,
|
|
|
|
paddingLeft: 10
|
|
|
|
},
|
2019-10-30 14:34:24 +00:00
|
|
|
flex: 1,
|
|
|
|
fontSize: 24,
|
|
|
|
paddingBottom: theme.spacing(2)
|
|
|
|
}
|
|
|
|
}));
|
2019-06-19 14:40:52 +00:00
|
|
|
|
2019-10-30 14:34:24 +00:00
|
|
|
interface PageHeaderProps {
|
2019-06-19 14:40:52 +00:00
|
|
|
children?: React.ReactNode;
|
|
|
|
className?: string;
|
|
|
|
title?: string;
|
|
|
|
}
|
|
|
|
|
2019-10-30 14:34:24 +00:00
|
|
|
const PageHeader: React.FC<PageHeaderProps> = props => {
|
|
|
|
const { children, className, title } = props;
|
|
|
|
|
|
|
|
const classes = useStyles(props);
|
|
|
|
|
|
|
|
return (
|
2019-06-19 14:40:52 +00:00
|
|
|
<ExtendedPageHeader
|
|
|
|
className={className}
|
|
|
|
title={
|
|
|
|
<Typography className={classes.title} variant="h5">
|
|
|
|
{title !== undefined ? title : <Skeleton style={{ width: "10em" }} />}
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
>
|
2019-08-09 11:14:35 +00:00
|
|
|
<div className={classes.root}>{children}</div>
|
2019-06-19 14:40:52 +00:00
|
|
|
</ExtendedPageHeader>
|
2019-10-30 14:34:24 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2019-06-19 14:40:52 +00:00
|
|
|
PageHeader.displayName = "PageHeader";
|
|
|
|
export default PageHeader;
|