PageViewLayout.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. className?: string,
  7. children?: ReactNode,
  8. headerContents?: ReactNode,
  9. sideContents?: ReactNode,
  10. footerContents?: ReactNode,
  11. expandContentWidth?: boolean,
  12. }
  13. export const PageViewLayout = (props: Props): JSX.Element => {
  14. const {
  15. className,
  16. children, headerContents, sideContents, footerContents,
  17. expandContentWidth,
  18. } = props;
  19. const fluidLayoutClass = expandContentWidth ? _fluidLayoutClass : '';
  20. return (
  21. <>
  22. <div className={`main ${className} ${pageViewLayoutClass} ${fluidLayoutClass} flex-expand-vert ps-sidebar`}>
  23. <div className="container-lg wide-gutter-x-lg grw-container-convertible flex-expand-vert">
  24. { headerContents != null && headerContents }
  25. { sideContents != null
  26. ? (
  27. <div className="flex-expand-horiz gap-3 z-0">
  28. <div className="flex-expand-vert flex-basis-0 mw-0">
  29. {children}
  30. </div>
  31. <div className="grw-side-contents-container col-lg-3 d-edit-none d-print-none" data-vrt-blackout-side-contents>
  32. <div className="grw-side-contents-sticky-container">
  33. {sideContents}
  34. </div>
  35. </div>
  36. </div>
  37. )
  38. : (
  39. <div className="z-0">
  40. {children}
  41. </div>
  42. )
  43. }
  44. </div>
  45. </div>
  46. { footerContents != null && (
  47. <footer className={`footer d-edit-none container-lg wide-gutter-x-lg ${fluidLayoutClass}`}>
  48. {footerContents}
  49. </footer>
  50. ) }
  51. </>
  52. );
  53. };