Layout scaffolding for Web apps.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 1.4 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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';