PageViewLayout.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type { ReactNode } from 'react';
  2. import styles from './PageViewLayout.module.scss';
  3. const pageViewLayoutClass = styles['page-view-layout'] ?? '';
  4. const _fluidLayoutClass = styles['fluid-layout'] ?? '';
  5. type Props = {
  6. children?: ReactNode,
  7. headerContents?: ReactNode,
  8. sideContents?: ReactNode,
  9. footerContents?: ReactNode,
  10. expandContentWidth?: boolean,
  11. }
  12. export const PageViewLayout = (props: Props): JSX.Element => {
  13. const {
  14. children, headerContents, sideContents, footerContents,
  15. expandContentWidth,
  16. } = props;
  17. const fluidLayoutClass = expandContentWidth ? _fluidLayoutClass : '';
  18. return (
  19. <>
  20. <div className={`main ${pageViewLayoutClass} ${fluidLayoutClass} flex-expand-vert ps-sidebar`}>
  21. <div className="container-lg wide-gutter-x-lg grw-container-convertible flex-expand-vert">
  22. { headerContents != null && headerContents }
  23. { sideContents != null
  24. ? (
  25. <div className="flex-expand-horiz gap-3">
  26. <div className="flex-expand-vert flex-basis-0 mw-0">
  27. {children}
  28. </div>
  29. <div className="grw-side-contents-container col-lg-3 d-edit-none d-print-none" data-vrt-blackout-side-contents>
  30. <div className="grw-side-contents-sticky-container">
  31. {sideContents}
  32. </div>
  33. </div>
  34. </div>
  35. )
  36. : (
  37. <>{children}</>
  38. )
  39. }
  40. </div>
  41. </div>
  42. { footerContents != null && (
  43. <footer className={`footer d-edit-none wide-gutter-x-lg ${fluidLayoutClass}`}>
  44. {footerContents}
  45. </footer>
  46. ) }
  47. </>
  48. );
  49. };