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.
 
 
 

49 lines
888 B

  1. import * as React from 'react'
  2. import styled, { createGlobalStyle } from 'styled-components'
  3. import TopBar from '../../widgets/TopBar'
  4. import {configVar, loadConfig} from '../../utilities/helpers'
  5. const Config = createGlobalStyle({
  6. ...loadConfig(),
  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(${configVar('base-width')} * 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. <>
  31. <Config />
  32. <TopBar
  33. brand={brand}
  34. userLink={userLink}
  35. >
  36. {topBarCenter}
  37. </TopBar>
  38. <ContentBase>
  39. {children}
  40. </ContentBase>
  41. </>
  42. )
  43. }