summaryrefslogtreecommitdiff
path: root/src/components/project-detail.js
blob: 430b36b08275df63f4255ee518e6800fda32e4ea (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
55
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;
  flex: 1;
  justify-content: flex-start;
  @media (min-width: ${breakpoints[0].breakpoint}px) {
    margin: 0 0 0 ${margins.md}px;
  }
  & > * {
    margin: 0 0 ${margins.md}px 0;
  }
`

const imgContainerStyle = css`
  display: flex;
  flex-wrap: wrap;
  & > *: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>
)