Layout scaffolding for Web apps.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 lines
1.0 KiB

  1. import * as React from 'react';
  2. import {LayoutArgs, layouts, Span} from '@tesseract-design/viewfinder-base';
  3. export type RootProps = React.HTMLProps<HTMLDivElement> & {
  4. topBarWidget?: React.ReactNode;
  5. }
  6. export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
  7. children,
  8. topBarWidget,
  9. ...etcProps
  10. }, ref) => (
  11. <>
  12. {topBarWidget}
  13. <main
  14. {...etcProps}
  15. className={layouts.Basic.ContentBase()}
  16. ref={ref}
  17. >
  18. {children}
  19. </main>
  20. </>
  21. ));
  22. Root.displayName = 'Root';
  23. export type ContentContainerProps = Omit<React.HTMLProps<HTMLDivElement>, 'span'> & {
  24. span?: Span,
  25. }
  26. export const ContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
  27. children,
  28. span = Span.NORMAL,
  29. }, ref) => {
  30. const args = React.useMemo<LayoutArgs>(() => ({
  31. span,
  32. mainSidebarOpen: false,
  33. }), [
  34. span
  35. ]);
  36. return (
  37. <div
  38. className={layouts.Basic.ContentContainer(args)}
  39. ref={ref}
  40. >
  41. {children}
  42. </div>
  43. )
  44. });
  45. ContentContainer.displayName = 'ContentContainer'