modules/post/components/Post.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 41
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 35
mnd 0
bc 0
fnc 1
dl 0
loc 41
ccs 4
cts 4
cp 1
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A Post.js ➔ createMarkup 0 2 1
1
import React from 'react'
2
import PropTypes from 'prop-types'
3
import Row from 'react-bootstrap/Row'
4
import Container from '~/modules/post/components/post/Container'
5
import Header from '~/modules/post/components/post/Header'
6
import PostInfo from '~/modules/post/components/post/PostInfo'
7
import Content from '~/modules/post/components/post/Content'
8
9 1
const Post = ({ data }) => (
10 1
  <Container>
11
    <article>
12
      <Row>
13
        <Header>{data.header}</Header>
14
      </Row>
15
      <PostInfo
16
        authorName={data.authorName}
17
        avatar={'/images/blogs/default-avatar.png'}
18
        date={data.date}
19
        minRead={data.minRead}
20
      />
21
      <Content>
22
        <div dangerouslySetInnerHTML={createMarkup(data.content)} />
23
      </Content>
24
    </article>
25
  </Container>
26
)
27
function createMarkup(content) {
28 1
  return { __html: content }
29
}
30
31 1
Post.propTypes = {
32
  data: PropTypes.shape({
33
    header: PropTypes.string,
34
    authorName: PropTypes.string,
35
    date: PropTypes.string,
36
    minRead: PropTypes.string,
37
    content: PropTypes.string
38
  })
39
}
40
export default Post
41