|
|
@ -6,7 +6,7 @@ import Color from 'color';
|
|
|
|
|
|
|
|
|
|
|
|
import { Theme, withTheme } from '@material-ui/core/styles';
|
|
|
|
import { Theme, withTheme } from '@material-ui/core/styles';
|
|
|
|
|
|
|
|
|
|
|
|
export default withTheme((props: {text: string, backgroundColor?: string, children?: any, theme: Theme}) => {
|
|
|
|
export default withTheme((props: {text: string, backgroundColor?: string, children?: any, rightItem?: React.ReactNode, theme: Theme}) => {
|
|
|
|
const backgroundColor = props.backgroundColor ?? props.theme.palette.secondary.main;
|
|
|
|
const backgroundColor = props.backgroundColor ?? props.theme.palette.secondary.main;
|
|
|
|
const foregroundColor = props.theme.palette.getContrastText(Color(backgroundColor).rgb().string());
|
|
|
|
const foregroundColor = props.theme.palette.getContrastText(Color(backgroundColor).rgb().string());
|
|
|
|
const style = {
|
|
|
|
const style = {
|
|
|
@ -14,6 +14,8 @@ export default withTheme((props: {text: string, backgroundColor?: string, childr
|
|
|
|
backgroundColor,
|
|
|
|
backgroundColor,
|
|
|
|
color: foregroundColor,
|
|
|
|
color: foregroundColor,
|
|
|
|
padding: 15,
|
|
|
|
padding: 15,
|
|
|
|
|
|
|
|
display: 'flex',
|
|
|
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
headerText: {
|
|
|
|
headerText: {
|
|
|
|
marginTop: 10,
|
|
|
|
marginTop: 10,
|
|
|
@ -23,8 +25,11 @@ export default withTheme((props: {text: string, backgroundColor?: string, childr
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div style={style.header}>
|
|
|
|
<div style={style.header}>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<h2 style={style.headerText}>{props.text}</h2>
|
|
|
|
<h2 style={style.headerText}>{props.text}</h2>
|
|
|
|
{props.children}
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{props.rightItem}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|