This commit is contained in:
David Ralph
2020-08-26 22:19:36 +01:00
parent 348d3e8578
commit 2814174a38
4 changed files with 14 additions and 10 deletions

View File

@@ -6,8 +6,10 @@ export default class Update extends React.PureComponent {
super(...args);
this.state = {
title: this.props.language.title,
date: '26/08/2020',
content: this.props.language.title
date: '???',
content: this.props.language.title,
url: '',
author: 'Mue'
};
}
@@ -22,7 +24,11 @@ export default class Update extends React.PureComponent {
data = await data.json();
this.setState({
title: data.title,
content: data.content
content: data.content,
date: data.published,
image: data.image,
url: data.url,
author: data.author
});
} catch (e) { // If it fails, we send an error
this.setState({
@@ -41,8 +47,9 @@ export default class Update extends React.PureComponent {
return <div className='updateContent'>
<span className='closeModal' onClick={this.props.modalClose}>&times;</span>
<h1 style={{ 'marginBottom':'-10px' }} dangerouslySetInnerHTML={{__html: this.state.title}}></h1>
<h5 style={{ 'lineHeight':'0px' }}> By Mue <span dangerouslySetInnerHTML={{__html: this.state.date}}></span></h5>
<p dangerouslySetInnerHTML={{__html: this.state.content}}></p>
<h5 style={{ 'lineHeight':'0px' }}> By {this.state.author} {this.state.date}</h5>
<img src={this.state.image} alt='Update'></img>
<p dangerouslySetInnerHTML={{__html: this.state.content + `<br/><p>Read on the blog here: <a href='${this.state.url}'>${this.state.url}</a></p>`}}></p>
</div>;
}
}