|
1
|
import React, { Component } from 'react'; |
|
2
|
import { FormattedMessage } from 'react-intl'; |
|
3
|
import Firebase from './Firebase'; |
|
4
|
import app from 'firebase/app'; |
|
5
|
|
|
6
|
type CvProps = { |
|
7
|
firebase: Firebase | null |
|
8
|
} |
|
9
|
|
|
10
|
type CvState = { |
|
11
|
content: string |
|
12
|
} |
|
13
|
|
|
14
|
class Cv extends Component<CvProps, CvState> { |
|
15
|
|
|
16
|
cvRef: app.database.Reference | undefined; |
|
17
|
|
|
18
|
constructor(props: CvProps) { |
|
19
|
super(props); |
|
20
|
this.cvRef = this.props.firebase?.cvRef(); |
|
21
|
this.state = { |
|
22
|
content: "Loading ..." |
|
23
|
} |
|
24
|
} |
|
25
|
componentDidMount() { |
|
26
|
this.cvRef?.on('value', (snapshot) => { |
|
27
|
let items = snapshot?.val(); |
|
28
|
this.setState({ |
|
29
|
content: items.content |
|
30
|
}); |
|
31
|
}); |
|
32
|
} |
|
33
|
|
|
34
|
componentWillUnmount() { |
|
35
|
this.cvRef?.off(); |
|
36
|
} |
|
37
|
|
|
38
|
render() { |
|
39
|
return ( |
|
40
|
<div> |
|
41
|
<h1> |
|
42
|
<FormattedMessage id="cv.title" |
|
43
|
defaultMessage="CV" |
|
44
|
description="CV page title"/> |
|
45
|
</h1> |
|
46
|
<p style={{lineHeight: "150%"}}>{this.state.content}</p> |
|
47
|
</div> |
|
48
|
); |
|
49
|
} |
|
50
|
} |
|
51
|
|
|
52
|
export default Cv; |