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.
 
 
 

38 lines
794 B

  1. import * as React from 'react';
  2. import {LayoutArgs, layouts, Span} from '@tesseract-design/viewfinder-base';
  3. export type LeftSidebarBaseProps = Omit<React.HTMLProps<HTMLDivElement>, 'span'> & {
  4. span?: Span,
  5. }
  6. export const LeftSidebarBase = React.forwardRef<HTMLDivElement, LeftSidebarBaseProps>(({
  7. children,
  8. span = Span.WIDE,
  9. open = false,
  10. ...etcProps
  11. }, ref) => {
  12. const args = React.useMemo<LayoutArgs>(() => ({
  13. span,
  14. mainSidebarOpen: open,
  15. }), [
  16. span,
  17. open,
  18. ]);
  19. return (
  20. <div
  21. className={layouts.LeftSidebar.SidebarBase(args)}
  22. {...etcProps}
  23. ref={ref}
  24. >
  25. <div
  26. className={layouts.LeftSidebar.SidebarOverflow()}
  27. >
  28. {children}
  29. </div>
  30. </div>
  31. )
  32. });
  33. LeftSidebarBase.displayName = 'LeftSidebarBase'