summaryrefslogtreecommitdiff
path: root/src/components/project-detail.js
blob: f84a5c97840cae231204c03f6146031db508b79b (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import React from 'react'
import { css } from '@emotion/core'

import { SplitContainer } from './split-container'
import { Image } from './image'
import { margins, breakpoints } from './globals'

const descContainerStyle = css`
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  @media (min-width: ${breakpoints[0].breakpoint}px) {
    margin: 0 0 0 ${margins.md}px;
    flex: 1;
  }
  & > * {
    margin: 0 0 ${margins.md}px 0;
  }
`

const imgContainerStyle = css`
  display: flex;
  & > *:not(:last-child) {
    margin-right: ${margins.sm}px;
  }
`

export const ProjectDetail = ({ listItems, header, images }) => (
  <section
    css={css`
      width: 100%;
      margin-bottom: ${margins.md}px;
    `}
  >
    <SplitContainer>
      <div css={descContainerStyle}>
        {header ? <h4>{header}</h4> : null}
        {listItems ? (
          <ul>
            {listItems.map((k, i) => (
              <li key={`detail-item-${i}`}>{k}</li>
            ))}
          </ul>
        ) : null}
      </div>
      <div css={imgContainerStyle}>
        {images
          ? images.map((k, i) => <Image key={`image-${i}`} {...k} />)
          : null}
      </div>
    </SplitContainer>
  </section>
)