Layout scaffolding for Web apps.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

58 行
986 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. {
  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. }