import * as React from 'react'; import {Skeleton} from '../../index'; import {IMenuSiderProps} from '../menu_sider/MenuSider'; import {IHeaderProps} from '../page_header/PageHeader'; import * as styles from './pageLayout.m.scss'; import {joinClassNames} from '../..'; interface IProps { menuComponent?: React.ReactElement; headerComponent?: React.ReactElement; noBodyPadding?: boolean; 'data-qaid'?: string; isWaiting?: boolean; footerComponent?: React.ReactElement; } export class PageLayout extends React.PureComponent { renderWithHeader = (dataQaid?: string) => { const bodyClass = joinClassNames( styles.headerChildren, [styles.noBodyPadding, this.props.noBodyPadding === true] ); return (
{this.props.headerComponent} {this.props.isWaiting === true ? ( ) : (
{this.props.children}
)} {this.props.footerComponent && (
{this.props.footerComponent}
)}
); }; renderWithMenu = (dataQaid?: string) => { return (
{this.props.menuComponent}
{this.renderWithHeader()}
); }; override render () { if (this.props.menuComponent !== undefined) { return this.renderWithMenu(this.props['data-qaid']); } return this.renderWithHeader(this.props['data-qaid']); } }