Remove the secondary header and update the appbar instead.
parent
cf435118d4
commit
8f13da7a39
@ -1,23 +0,0 @@
|
|||||||
import * as React from 'react';
|
|
||||||
|
|
||||||
import { Theme, withTheme } from '@material-ui/core/styles';
|
|
||||||
|
|
||||||
export default withTheme()((props: {children: React.ReactNode | React.ReactNode[], theme: Theme}) => {
|
|
||||||
const style = {
|
|
||||||
header: {
|
|
||||||
backgroundColor: props.theme.palette.primary.main,
|
|
||||||
color: props.theme.palette.primary.contrastText,
|
|
||||||
padding: 15,
|
|
||||||
textAlign: 'center' as any,
|
|
||||||
},
|
|
||||||
headerText: {
|
|
||||||
margin: 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={style.header}>
|
|
||||||
<h2 style={style.headerText}>{props.children}</h2>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
});
|
|
@ -0,0 +1,20 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import * as ReactDOM from 'react-dom';
|
||||||
|
|
||||||
|
export default (props: {title: string, children?: React.ReactNode | React.ReactNode[]}) => {
|
||||||
|
const titleEl = document.querySelector('#appbar-title');
|
||||||
|
const buttonsEl = document.querySelector('#appbar-buttons');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{titleEl && ReactDOM.createPortal(
|
||||||
|
<span>{props.title}</span>,
|
||||||
|
titleEl
|
||||||
|
)}
|
||||||
|
{buttonsEl && props.children && ReactDOM.createPortal(
|
||||||
|
props.children,
|
||||||
|
buttonsEl
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue