Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 51 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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's Square, Manchester</div> |
||
45 | </article> |
||
46 | ); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | export default Me; |
||
51 |