summaryrefslogtreecommitdiff
path: root/src/components/project.js
blob: 9b5bf7e09a5e91736d35926fc409eeac06e095c6 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
import React from 'react'
import { css } from '@emotion/core'

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faLink } from '@fortawesome/free-solid-svg-icons'

import { Tag } from './tag'
import { margins, breakpoints } from './globals'

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

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

const imgStyle = css`
  max-height: 85vw;
`

const linkStyle = 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 = css`
  margin: 0 0 ${margins.lg}px 0;
`

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

const projectHeadingContainerStyle = 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 = css`
  margin-bottom: ${margins.sm}px;
`

export const Project = p => {
  const marginRight = p.imgUrl ? margins.md : 0
  const descContainerStyle = css`
    font-weight: 300;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: ${margins.md}px 0 0 0;
    @media (min-width: ${breakpoints[0].breakpoint}px) {
      margin: 0 0 0 ${marginRight}px;
      flex: 1;
    }
    & > * {
      margin: 0 0 ${margins.md}px 0;
    }

    & img {
      max-height: 150px;
      align-self: flex-end;
      box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
        0 15px 12px rgba(0, 0, 0, 0.22);
      margin-bottom: ${margins.md}px;
    }
  `
  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>
              <FontAwesomeIcon 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.imgUrl ? <img src={p.imgUrl} alt={p.imgAlt} css={imgStyle} /> : null}
        {p.desc ? <div css={descContainerStyle}>{p.desc}</div> : null}
      </div>
    </article>
  )
}