From e1644f8dc734b81b1faf3b3f4488c70e28ef1c21 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 28 Jun 2018 15:27:15 +0300 Subject: accept text for Post and MessageInput --- vnext/src/components/Message.js | 4 ++-- vnext/src/components/MessageInput.js | 5 +++-- vnext/src/components/Post.js | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'vnext') diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js index e9d3eebd..585ae1ac 100644 --- a/vnext/src/components/Message.js +++ b/vnext/src/components/Message.js @@ -51,13 +51,13 @@ export default function Message(props) {  Recommend ) : visitor.uid > 0 ? ( - + {msg.likes > 0 && (` ${msg.likes}`)}  Recommend - + ) : ( diff --git a/vnext/src/components/MessageInput.js b/vnext/src/components/MessageInput.js index 5ef654a8..5d603a4b 100644 --- a/vnext/src/components/MessageInput.js +++ b/vnext/src/components/MessageInput.js @@ -16,7 +16,7 @@ export default class MessageInput extends React.Component { mid: this.props.data.mid, rid: this.props.data.rid || 0, to: this.props.data.to || {}, - body: '', + body: this.props.text || '', attach: '' } } @@ -131,5 +131,6 @@ const textInputStyle = { MessageInput.propTypes = { data: MessageType.isRequired, onSend: PropTypes.func.isRequired, - rows: PropTypes.string + rows: PropTypes.string, + text: PropTypes.string }; \ No newline at end of file diff --git a/vnext/src/components/Post.js b/vnext/src/components/Post.js index fd577603..7bde7432 100644 --- a/vnext/src/components/Post.js +++ b/vnext/src/components/Post.js @@ -1,4 +1,5 @@ import React from 'react'; +import * as qs from 'query-string'; import MessageInput from './MessageInput'; @@ -7,9 +8,10 @@ import { post } from '../api'; export default class Post extends React.Component { constructor(props) { super(props) + let params = qs.parse(window.location.search); this.state = { attach: '', - body: '' + body: params.body || '' } this.fileinput = React.createRef(); console.log(props) @@ -39,7 +41,7 @@ export default class Post extends React.Component { render() { return (
- + *weather It's very cold today!
-- cgit v1.2.3