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.
 
 
 

48 lines
886 B

  1. import * as React from 'react'
  2. import styled from 'styled-components';
  3. import TopBar from '../../widgets/TopBar';
  4. const LayoutBase = styled('div')({
  5. '--width-base': 'var(--width-base, 360px)',
  6. '--height-topbar': 'var(--height-topbar, 4rem)',
  7. })
  8. const ContentBase = styled('main')({
  9. boxSizing: 'border-box',
  10. })
  11. export const ContentContainer = styled('div')({
  12. padding: '0 1rem',
  13. boxSizing: 'border-box',
  14. margin: '0 auto',
  15. maxWidth: 'calc(var(--width-base, 360px) * 2)',
  16. width: '100%',
  17. })
  18. type Props = {
  19. brand?: React.ReactNode,
  20. userLink?: React.ReactNode,
  21. topBarCenter?: React.ReactChild,
  22. }
  23. export const Layout: React.FC<Props> = ({
  24. brand,
  25. userLink,
  26. topBarCenter,
  27. children,
  28. }) => {
  29. return (
  30. <LayoutBase>
  31. <TopBar
  32. brand={brand}
  33. userLink={userLink}
  34. >
  35. {topBarCenter}
  36. </TopBar>
  37. <ContentBase>
  38. {children}
  39. </ContentBase>
  40. </LayoutBase>
  41. )
  42. }