diff options
author | Renard | 2019-09-12 00:24:37 -0300 |
---|---|---|
committer | Renard | 2019-09-12 00:24:37 -0300 |
commit | 8ea1b415d5c288908d687e6ee8d0c275089b1039 (patch) | |
tree | cae65f88154a6d681c45e8b138c4fde1046fc437 /src/Board.js | |
parent | 0a5b872a0762467697d3c662cc41c922294505ff (diff) | |
download | bai-client-8ea1b415d5c288908d687e6ee8d0c275089b1039.tar.gz bai-client-8ea1b415d5c288908d687e6ee8d0c275089b1039.tar.xz bai-client-8ea1b415d5c288908d687e6ee8d0c275089b1039.zip |
Fix: Imagenes y componentUpdate
Diffstat (limited to 'src/Board.js')
-rw-r--r-- | src/Board.js | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/Board.js b/src/Board.js index 759079b..5a4e620 100644 --- a/src/Board.js +++ b/src/Board.js @@ -1,5 +1,5 @@ import React, { Component } from "react"; -import { Loader, Message, Segment, Header } from "semantic-ui-react"; +import { Loader, Message, Segment, Header, Icon, Image } from "semantic-ui-react"; import { Link } from "@reach/router"; import Moment from "react-moment"; import "moment/locale/es"; @@ -27,6 +27,22 @@ class Board extends Component { .catch(console.error) } + componentWillUnmount() { + console.log("will unmount") + } + + componentDidUpdate(prevProps) { + // Uso tipico (no olvides de comparar los props): + if (this.props.dir !== prevProps.dir) { + this.setState({ + isLoaded: false, + threadList: [], + error: null + }) + this.componentDidMount(); + } + } + render() { const { isLoaded, error, threadList } = this.state; @@ -63,9 +79,14 @@ class Board extends Component { <div dangerouslySetInnerHTML={{ __html: thread.message }} /> </Segment> {thread.replies.map(reply => - <Segment attached> - <div dangerouslySetInnerHTML={{ __html: reply.message }} /> - </Segment> + <Segment.Group horizontal key={reply.id}> + {reply.file != "" ? <Segment compact> <Image src={`https://bienvenidoainternet.org/${this.props.dir}/thumb/${reply.thumb}`} /></Segment> : null} + <Segment> + <div className="postMessage" dangerouslySetInnerHTML={{ __html: reply.message }} /> + <Icon name="reply" />Responder + <Icon name="exclamation circle" />Reportar + </Segment> + </Segment.Group> )} </Segment.Group> |