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.
 
 
 

59 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. {sidebarBaseWidget}
  15. <div
  16. {...etcProps}
  17. ref={ref}
  18. data-viewfinder="main"
  19. className="box-border md:pl-[calc(50%-(var(--base-width)*0.5))]"
  20. >
  21. {children}
  22. </div>
  23. </>
  24. ));
  25. export interface ContentContainerProps extends React.HTMLProps<HTMLDivElement> {}
  26. export const MainContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
  27. children,
  28. }, ref) => (
  29. <div
  30. className="px-8 box-border w-full max-w-[calc(var(--base-width)*2)] mx-auto md:ml-0"
  31. ref={ref}
  32. >
  33. {children}
  34. </div>
  35. ));
  36. MainContentContainer.displayName = 'MainContentContainer'
  37. export interface SidebarMainContainerProps extends React.HTMLProps<HTMLDivElement> {}
  38. export const SidebarContentContainer = React.forwardRef<HTMLDivElement, SidebarMainContainerProps>(({
  39. children,
  40. ...etcProps
  41. }, ref) => (
  42. <div
  43. {...etcProps}
  44. className="w-full mx-auto px-8 box-border max-w-[calc(var(--base-width)*2)] md:w-[var(--base-width)] md:mr-0"
  45. ref={ref}
  46. >
  47. {children}
  48. </div>
  49. ));
  50. SidebarContentContainer.displayName = 'SidebarMainContainer';