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.
 
 
 

62 lines
1.4 KiB

  1. import * as React from 'react';
  2. export interface RootProps extends React.HTMLProps<HTMLDivElement> {
  3. sidebarBaseWidget?: React.ReactNode;
  4. topBarWidget?: React.ReactNode;
  5. };
  6. export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
  7. children,
  8. topBarWidget,
  9. sidebarBaseWidget,
  10. ...etcProps
  11. }, ref) => (
  12. <>
  13. {topBarWidget}
  14. <div
  15. {...etcProps}
  16. ref={ref}
  17. data-viewfinder="main"
  18. className="box-border md:pr-[calc(50%-(var(--base-width)*0.5))]"
  19. >
  20. {children}
  21. </div>
  22. {sidebarBaseWidget}
  23. </>
  24. ))
  25. Root.displayName = 'Root';
  26. export interface ContentContainerProps extends React.HTMLProps<HTMLDivElement> {}
  27. export const MainContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
  28. children,
  29. }, ref) => (
  30. <div
  31. className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:mr-0"
  32. ref={ref}
  33. >
  34. {children}
  35. </div>
  36. ));
  37. MainContentContainer.displayName = 'MainContentContainer';
  38. export interface SidebarMainContainerProps extends React.HTMLProps<HTMLDivElement> {}
  39. export const SidebarContentContainer = React.forwardRef<HTMLDivElement, SidebarMainContainerProps>(({
  40. children,
  41. ...etcProps
  42. }, ref) => (
  43. <div
  44. {...etcProps}
  45. className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0 md:w-[var(--base-width)]"
  46. ref={ref}
  47. >
  48. {children}
  49. </div>
  50. ));
  51. SidebarContentContainer.displayName = 'SidebarMainContainer';