summaryrefslogtreecommitdiff
path: root/src/components/image.js
blob: ab276d98efc8f60582db36b8b60c6c1b80595b2d (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
import React from 'react'
import { css } from '@emotion/core'

const imgContainerStyle = css`
  text-align: right;
  & a {
    border-bottom: none;
  }
`

export const Image = ({ imgUrl, caption, noShadow }) => {
  const imgStyle = ({ margins }) => css`
    max-height: 300px;
    max-width: 80vw;
    align-self: flex-end;
    ${!noShadow
      ? `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 (
    <div css={imgContainerStyle}>
      <a href={imgUrl} target="_blank" rel="noopener noreferrer">
        <img css={imgStyle} src={imgUrl} alt={caption} />
      </a>
    </div>
  )
}