saleor-dashboard/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx

60 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-10-30 14:34:24 +00:00
import { makeStyles } from "@material-ui/core/styles";
2019-08-09 11:14:35 +00:00
import classNames from "classnames";
2019-08-09 10:26:22 +00:00
import React from "react";
2019-06-19 14:40:52 +00:00
2019-10-30 14:34:24 +00:00
const useStyles = makeStyles(theme => ({
action: {
2019-11-04 19:31:23 +00:00
flex: "0 0 auto",
[theme.breakpoints.down("sm")]: {
paddingLeft: 10
}
2019-10-30 14:34:24 +00:00
},
grid: {
padding: theme.spacing(2)
},
menuButton: {
flex: "0 0 auto",
marginLeft: -theme.spacing(2),
marginRight: theme.spacing(3),
marginTop: -theme.spacing(2)
},
root: {
alignItems: "center",
display: "flex",
2019-11-04 19:31:23 +00:00
marginBottom: theme.spacing(3),
[theme.breakpoints.down("sm")]: {
display: "block"
}
2019-10-30 14:34:24 +00:00
},
subtitle: {
alignItems: "center",
display: "flex",
marginBottom: theme.spacing(2)
},
title: {
flex: 1,
paddingBottom: theme.spacing(2)
}
}));
2019-06-19 14:40:52 +00:00
2019-10-30 14:34:24 +00:00
interface ExtendedPageHeaderProps {
2019-06-19 14:40:52 +00:00
children?: React.ReactNode;
className?: string;
title?: React.ReactNode;
}
2019-10-30 14:34:24 +00:00
const ExtendedPageHeader: React.FC<ExtendedPageHeaderProps> = props => {
const { children, className, title } = props;
const classes = useStyles(props);
return (
2019-06-19 14:40:52 +00:00
<div className={classNames(classes.root, className)}>
{title}
<div className={classes.action}>{children}</div>
</div>
2019-10-30 14:34:24 +00:00
);
};
2019-06-19 14:40:52 +00:00
ExtendedPageHeader.displayName = "ExtendedPageHeader";
export default ExtendedPageHeader;