Passed
Push — master ( f602d8...7b3414 )
by Huu-Phat
02:55 queued 11s
created

modules/home/components/certification/CertInfo.js   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 46
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 35
mnd 1
bc 1
fnc 0
dl 0
loc 46
ccs 5
cts 5
cp 1
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 10
1
import React from 'react'
2
import styled from 'styled-components/macro'
3
import Info from '~/modules/home/components/certification/Info'
4
import Title from '~/modules/home/components/certification/Title'
5
import { LEFT_INFO_POS } from '~/modules/home/consts/certification'
6
import PropTypes from 'prop-types'
7
import { Translate } from 'react-localize-redux'
8
import Col from 'react-bootstrap/Col'
9
10 1
const CertInfo = ({ itemSelected, id, title, content }) => {
11 4
  return (
12
    <ShowOnSelectedCol sm={12} xs={12} itemselected={itemSelected} id={id}>
13
      <ListInfo id={id}>
14
        <Title>
15
          <span>{id}</span> &mdash; <Translate id={title} />
16
        </Title>
17
        <p>
18
          <Translate id={content} />
19
        </p>
20
      </ListInfo>
21
    </ShowOnSelectedCol>
22
  )
23
}
24
25
export default CertInfo
26
27 1
CertInfo.propTypes = {
28
  itemSelected: PropTypes.number,
29
  id: PropTypes.number,
30
  title: PropTypes.string,
31
  content: PropTypes.string
32
}
33
34
const ListInfo = styled(Info)`
35
  position: relative;
36
37
  &::before,
38
  &::after {
39 4
    left: ${({ id }) => LEFT_INFO_POS[id - 1]};
40
  }
41
`
42
43
const ShowOnSelectedCol = styled(Col)`
44 4
  display: ${({ itemselected, id }) => (itemselected == id ? 'block' : 'none')};
45
`
46