lbry-desktop/ui/component/page/view.jsx

35 lines
1 KiB
React
Raw Normal View History

2018-03-26 14:32:43 -07:00
// @flow
2019-08-27 10:43:42 -04:00
import type { Node } from 'react';
import React, { Fragment } from 'react';
2018-03-26 14:32:43 -07:00
import classnames from 'classnames';
2019-12-18 00:27:08 -05:00
import SideNavigation from 'component/sideNavigation';
2019-08-27 10:43:42 -04:00
import Header from 'component/header';
2018-03-26 14:32:43 -07:00
2019-10-20 18:41:28 -04:00
export const MAIN_CLASS = 'main';
2018-03-26 14:32:43 -07:00
type Props = {
2019-08-27 10:43:42 -04:00
children: Node | Array<Node>,
2019-01-09 13:39:05 -05:00
className: ?string,
2019-08-27 10:43:42 -04:00
autoUpdateDownloaded: boolean,
isUpgradeAvailable: boolean,
2019-10-28 10:04:37 -04:00
authPage: boolean,
2019-09-26 12:07:11 -04:00
authenticated: boolean,
noHeader: boolean,
2018-03-26 14:32:43 -07:00
};
2019-06-17 16:32:38 -04:00
function Page(props: Props) {
const { children, className, authPage = false, authenticated, noHeader } = props;
2020-01-02 11:30:27 -05:00
const obscureSideNavigation = IS_WEB ? !authenticated : false;
2019-06-17 16:32:38 -04:00
2019-08-27 10:43:42 -04:00
return (
<Fragment>
{!noHeader && <Header authHeader={authPage} />}
2019-08-27 10:43:42 -04:00
<div className={classnames('main-wrapper__inner')}>
2019-10-20 18:41:28 -04:00
<main className={classnames(MAIN_CLASS, className, { 'main--full-width': authPage })}>{children}</main>
{!authPage && !noHeader && <SideNavigation obscureSideNavigation={obscureSideNavigation} />}
2019-08-27 10:43:42 -04:00
</div>
</Fragment>
);
}
2018-03-26 14:32:43 -07:00
export default Page;