src/components/page/Me.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 51
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 40
mnd 0
bc 0
fnc 3
dl 0
loc 51
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A Me.render 0 11 1
A Me.componentDidMount 0 5 1
A Me.showContent 0 8 1
1
/*eslint max-len: ["error", { "code": 150 }]*/
2
3
import React, { Component } from 'react';
4
import meImage from '../../assets/img/Paul-Moreland-2.jpg';
5
import meBackdrop from '../../assets/img/Manchester.jpg';
6
import base from '../../config/api.js';
7
let api = base.api();
8
9
10
class Me extends Component {
11
    constructor(props) {
12
        super(props);
13
        this.state = {
14
            para1: "",
15
            para2: "",
16
            para3: "",
17
        };
18
    }
19
20
    componentDidMount() {
21
        fetch(api)
22
            .then(res => res.json())
23
            .then(res => this.showContent(res));
24
    }
25
26
    showContent(res) {
27
        let data = res.data.me[0];
28
29
        this.setState({
30
            para1: data.para1,
31
            para2: data.para2,
32
            para3: data.para3
33
        });
34
    }
35
36
    render() {
37
        return (
38
            <article>
39
                <h1>Om Mig Själv</h1>
40
                <img src={meImage} className="me" alt="Bild på Paul Moreland" />
41
                <p>{ this.state.para1 }</p>
42
                <p>{ this.state.para2 }</p>
43
                <p>{ this.state.para3 }</p>
44
                <div className="backdrop"><img src={meBackdrop} className="Manchester" alt="Manchester" />St Peter&apos;s Square, Manchester</div>
45
            </article>
46
        );
47
    }
48
}
49
50
export default Me;
51