From 466aa625567db617149479b7b8f446d5537d320c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 20 Jun 2018 17:04:38 +0300 Subject: floating message input --- vnext/src/components/Thread.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index cfef2372..5b57fe0e 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -15,7 +15,8 @@ export default class Thread extends React.Component { super(props); this.state = { msg: {}, - replies: [] + replies: [], + active: 0 }; this.loaded = this.loaded.bind(this); this.postComment = this.postComment.bind(this); @@ -43,7 +44,8 @@ export default class Thread extends React.Component { let msg = data.shift(); this.setState({ msg: msg, - replies: data + replies: data, + active: 0 }) } ).catch(ex => { @@ -53,7 +55,11 @@ export default class Thread extends React.Component { loaded() { return this.state.msg.mid; } - + setActive(msg, event) { + this.setState({ + active: msg.rid || 0 + }) + } postComment(template) { const url = `https://api.juick.com/comment?hash=${this.props.visitor.hash}`; let form = new FormData(); @@ -81,7 +87,7 @@ export default class Thread extends React.Component { { this.loaded() ? ( - + { this.state.active === (msg.rid || 0) && } ) : ( @@ -143,8 +149,8 @@ export default class Thread extends React.Component { this.props.visitor.uid > 0 ? ( ·  - Reply -
+ + { this.state.active === msg.rid && }
) : ( -- cgit v1.2.3