modules/home/components/project/SelectedImage.js
last analyzed

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 34
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 0
eloc 23
mnd 0
bc 0
fnc 0
dl 0
loc 34
ccs 2
cts 6
cp 0.3333
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import React from 'react'
2
import PropTypes from 'prop-types'
3
import styled from 'styled-components/macro'
4
5 1
const SelectedImage = ({ index, photo, margin, onClick }) => (
6
  <div style={{ margin, height: photo.height, width: photo.width }}>
7
    <Image alt={photo.title} {...photo} onClick={() => onClick(index)} />
8
  </div>
9
)
10
11 1
SelectedImage.propTypes = {
12
  index: PropTypes.number,
13
  photo: PropTypes.shape({
14
    title: PropTypes.string,
15
    height: PropTypes.number,
16
    width: PropTypes.number
17
  }),
18
  margin: PropTypes.string,
19
  onClick: PropTypes.func
20
}
21
22
export default SelectedImage
23
24
const Image = styled.img`
25
  border: 0.5px solid ${props => props.theme.colors.colorDarken};
26
27
  &:hover {
28
    transition: transform 0.135s cubic-bezier(0, 0, 0.2, 1),
29
      opacity linear 0.15s;
30
    opacity: 0.6;
31
    border: 3px solid ${props => props.theme.colors.colorAccent};
32
  }
33
`
34