summaryrefslogtreecommitdiff
path: root/src/components/project.js
blob: 72665d2d14b49178f6a050761aba992d1f1b9531 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import React from 'react'
import { css } from '@emotion/core'

import { FontAwesome } from './font-awesome'
import { faLink } from '@fortawesome/free-solid-svg-icons'

import { Tag } from './tag'
import { ProjectDetail } from './project-detail'

const projectHeadingStyle = ({ margins }) => css`
  margin: 0 ${margins.sm}px 0 0;
`
const projectBriefStyle = css`
  font-weight: 300;
`

const projectBlockStyle = css`
  display: flex;
  flex-wrap: wrap;
`

const linkStyle = ({ margins }) => css`
  display: flex;
  align-content: center;
  margin: 0 ${margins.sm}px 0 0;
  padding: 0 0 ${margins.sm}px 0;
  border-color: rgba(0, 0, 0, 0);
  :hover {
    border-color: #ffffff;
  }
`

const projectStyle = ({ margins }) => css`
  margin: 0 0 ${margins.lg}px 0;
  & > * {
    margin: 0 0 ${margins.md}px 0;
  }
`

const linkIconStyle = css`
  display: flex;
  align-items: center;
`

const projectHeadingContainerStyle = ({ margins }) => css`
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: ${margins.md}px;
  flex-wrap: wrap;
`

const projectTagContainerStyle = css`
  display: flex;
  align-items: center;
  flex-wrap: wrap;
`

const dateStyle = ({ margins }) => css`
  margin-bottom: ${margins.sm}px;
`

export const Project = p => {
  return (
    <article css={projectStyle}>
      <div css={projectHeadingContainerStyle}>
        <div css={projectTagContainerStyle}>
          <a
            css={linkStyle}
            href={p.url}
            target="_blank"
            rel="noopener noreferrer"
          >
            <div css={linkIconStyle}>
              <h2 css={projectHeadingStyle}>{p.name}</h2>
              <FontAwesome icon={faLink} />
            </div>
          </a>
          {p.inProd ? <Tag fontSize="0.8em">In Prod</Tag> : null}
        </div>
        <p css={dateStyle}>{p.date}</p>
      </div>
      <h3 css={projectBriefStyle}>{p.brief}</h3>
      <div css={projectBlockStyle}>
        {p.desc ? (
          <div
            css={({ margins }) => css`
              margin-bottom: ${margins.md}px;
            `}
          >
            <p>{p.desc}</p>
          </div>
        ) : null}
        {p.projectDetails
          ? p.projectDetails.map((k, i) => (
              <ProjectDetail key={`project-detail-${i}`} {...k} />
            ))
          : null}
      </div>
    </article>
  )
}