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.1 KiB

  1. import * as React from 'react';
  2. import clsx from 'clsx';
  3. import { SpanValues as Span } from '@tesseract-design/viewfinder-base';
  4. export interface RootProps extends React.HTMLProps<HTMLDivElement> {
  5. topBarWidget?: React.ReactNode;
  6. }
  7. export const Root = React.forwardRef<HTMLDivElement, RootProps>(({
  8. children,
  9. topBarWidget,
  10. ...etcProps
  11. }, ref) => (
  12. <>
  13. {topBarWidget}
  14. <div
  15. {...etcProps}
  16. data-viewfinder="main"
  17. className="box-border"
  18. ref={ref}
  19. >
  20. {children}
  21. </div>
  22. </>
  23. ));
  24. Root.displayName = 'Root';
  25. export type ContentContainerProps = Omit<React.HTMLProps<HTMLDivElement>, 'span'> & {
  26. span?: Span,
  27. }
  28. export const ContentContainer = React.forwardRef<HTMLDivElement, ContentContainerProps>(({
  29. children,
  30. span = 'normal',
  31. }, ref) => {
  32. return (
  33. <div
  34. className={clsx(
  35. 'px-8 box-border mx-auto w-full',
  36. span === 'narrow' && 'max-w-screen-2xs',
  37. span === 'normal' && 'max-w-screen-xs',
  38. span === 'wide' && 'max-w-screen-sm',
  39. )}
  40. ref={ref}
  41. >
  42. {children}
  43. </div>
  44. );
  45. });
  46. ContentContainer.displayName = 'ContentContainer'