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.
 
 
 

48 lignes
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. }