diff options
Diffstat (limited to 'vnext/src')
-rw-r--r-- | vnext/src/components/Message.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js index 273e035c..509cae42 100644 --- a/vnext/src/components/Message.js +++ b/vnext/src/components/Message.js @@ -20,16 +20,14 @@ export default function Message({ data, visitor, children, ...rest }) { </span> <Avatar user={data.user} /> <div className="msg-ts"> - <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: {msg: data} }}> + <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: { msg: data } }}> <time itemProp="datePublished dateModified" itemType="http://schema.org/Date" dateTime={data.timestamp} title={moment.utc(data.timestamp).local().format('lll')}> {moment.utc(data.timestamp).fromNow()} </time> </Link> </div> - <div className="msg-tags" itemProp="headline"> - <Tags user={data.user} data={data.tags || []} /> - </div> + <Tags user={data.user} data={data.tags || []} /> </header> <div className="msg-txt"> <p itemProp="description" dangerouslySetInnerHTML={{ __html: format(data.body, data.mid, (data.tags || []).indexOf('code') >= 0) }}></p> @@ -49,7 +47,7 @@ export default function Message({ data, visitor, children, ...rest }) { <span> Recommend</span> </a> ) : visitor.uid > 0 ? ( - <Link to={{pathname: "/post", search: `?body=!+%23${data.mid}`}} className="a-like msg-button"> + <Link to={{ pathname: "/post", search: `?body=!+%23${data.mid}` }} className="a-like msg-button"> <span className="msg-button-icon"> <Icon name="ei-heart" size="s" /> {data.likes > 0 && (` ${data.likes}`)} @@ -67,7 +65,7 @@ export default function Message({ data, visitor, children, ...rest }) { )} {!Boolean(data.ReadOnly) | (visitor.uid === data.user.uid) && ( <React.Fragment> - <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: {msg: data} }} className="a-comment msg-button"> + <Link to={{ pathname: `/${data.user.uname}/${data.mid}`, state: { msg: data } }} className="a-comment msg-button"> <span className="msg-button-icon"> <Icon name="ei-comment" size="s" /> {data.replies > 0 && @@ -90,15 +88,21 @@ export default function Message({ data, visitor, children, ...rest }) { <a href="#" className="a-privacy">Открыть доступ</a> )} </nav> - { children } + {children} </div> ); } -function Tags({ data, user, ...rest}) { - return data && data.map(tag => { - return (<Link key={tag} to={{ pathname: `/${user.uname}`, search: `?tag=${tag}` }} title={tag}>{tag}</Link>) - }) +function Tags({ data, user, ...rest }) { + return data.length > 0 && ( + <div className="msg-tags" itemProp="headline"> + { + data.map(tag => { + return (<Link key={tag} to={{ pathname: `/${user.uname}`, search: `?tag=${tag}` }} title={tag}>{tag}</Link>) + }) + } + </div> + ); } Message.propTypes = { |