Layout scaffolding for Web apps.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.tsx 986 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. {
  33. (
  34. brand
  35. || userLink
  36. || topBarCenter
  37. )
  38. && (
  39. <TopBar
  40. brand={brand}
  41. userLink={userLink}
  42. >
  43. {topBarCenter}
  44. </TopBar>
  45. )
  46. }
  47. <ContentBase>
  48. {children}
  49. </ContentBase>
  50. </>
  51. )
  52. }