import * as React from 'react'; interface ResultsLayoutProps { leftComponent?: () => JSX.Element; rightComponent?: () => JSX.Element; headerComponent?: () => JSX.Element; footerComponent?: () => JSX.Element; rightRailComponent?: () => JSX.Element; } class ResultsLayout extends React.Component { constructor() { super(); } render() { const headerComponent = this.props.headerComponent ? ( this.props.headerComponent() ) : null; const leftComponent = this.props.leftComponent ? ( this.props.leftComponent() ) : null; const rightComponent = this.props.rightComponent ? ( this.props.rightComponent() ) : null; const footerComponent = this.props.footerComponent ? ( this.props.footerComponent() ) : null; const rightRailComponent = this.props.rightRailComponent ? (
{this.props.rightRailComponent()}
) : null; const rightColumns = rightRailComponent ? 'ten wide column' : (leftComponent ? 'twelve wide column' : 'sixteen wide column' ); const header = this.props.headerComponent ? (
{headerComponent}
) : null; const leftColumn = leftComponent ? (
{leftComponent}
) : null; const rightColumn = (
{rightComponent}
); return (
{header}
{leftColumn} {rightColumn} {rightRailComponent}
{footerComponent}
); } } export { ResultsLayoutProps, ResultsLayout };