summaryrefslogtreecommitdiff
path: root/src/components/container.js
blob: babed1b845e070d64e989baba0803266649fe32d (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'
import { breakpoints, margins } from './globals'

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

export const Container = p => {
  const containerStyle = 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}
  `
  return <div css={containerStyle}>{p.children}</div>
}