summaryrefslogtreecommitdiff
path: root/src/components/container.js
blob: b820706d4251bf5fb088cefee19bd8d9da990872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React from 'react'
import { css } from '@emotion/core'

const mq = breakpoints =>
  breakpoints
    .map(
      ({ breakpoint, size }) => `
      @media (min-width: ${breakpoint}) {
        width: ${size};
      }
    `
    )
    .join('\n')

export const Container = p => {
  const containerStyle = ({ breakpoints, margins }) => css`
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: ${margins.lg}px 0;
    width: 93%;
    height: ${p.height || '100%'};
    box-sizing: border-box;
    ${mq(breakpoints)}
  `
  return <div css={containerStyle}>{p.children}</div>
}