aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/Message.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/components/Message.js')
-rw-r--r--vnext/src/components/Message.js31
1 files changed, 14 insertions, 17 deletions
diff --git a/vnext/src/components/Message.js b/vnext/src/components/Message.js
index 0c322a66..d1a9c51f 100644
--- a/vnext/src/components/Message.js
+++ b/vnext/src/components/Message.js
@@ -3,7 +3,9 @@ import PropTypes from 'prop-types';
import ReactMarkdown from 'react-markdown';
import moment from 'moment';
+import { UserType } from './Types';
import Icon from './Icon';
+import Avatar from './Avatar';
export default function Message(props) {
const msg = props.data;
@@ -14,9 +16,7 @@ export default function Message(props) {
<span itemProp="author" itemScope="" itemType="http://schema.org/Person">
<a href={`/${msg.user.uname}/`} itemProp="url" rel="author"><span itemProp="name">{msg.user.uname}</span></a>
</span>
- <div className="msg-avatar"><a href={`/${msg.user.uname}/`}>
- <img src={`//i.juick.com/a/${msg.user.uid}.png`} alt={`${msg.user.uname}`} /></a>
- </div>
+ <Avatar user={msg.user} />
<div className="msg-ts">
<a href={`/${msg.user.uname}/${msg.mid}`}>
<time itemProp="datePublished dateModified" itemType="http://schema.org/Date" dateTime={msg.timestamp}
@@ -36,7 +36,7 @@ export default function Message(props) {
</p>
}
<nav className="l">
- { visitor.uid === msg.user.uid ? (
+ {visitor.uid === msg.user.uid ? (
<a href={`/${msg.user.uname}/${msg.mid}`} className="a-like msg-button">
<span className="msg-button-icon">
<Icon name="ei-heart" size="s" />
@@ -66,12 +66,12 @@ export default function Message(props) {
<a href={`/${msg.user.uname}/${msg.mid}`} className="a-comment msg-button">
<span className="msg-button-icon">
<Icon name="ei-comment" size="s" />
- { msg.replies > 0 &&
- (Boolean(msg.unread) ? (
+ {msg.replies > 0 &&
+ (Boolean(msg.unread) ? (
<span className="badge">${msg.replies}</span>
) : (
`${msg.replies}`
- ))
+ ))
}
</span>
<span>&nbsp;Comment</span>
@@ -91,24 +91,21 @@ export default function Message(props) {
}
function Tags(props) {
- return props.data && props.data.map(tag => {
- return (<a key={tag} href={`/tag/${tag}`} title={tag}>{tag}</a>)
+ return props.data && props.data.map(tag => {
+ return (<a key={tag} href={`/tag/${tag}`} title={tag}>{tag}</a>)
})
}
-Tags.propTypes = {
- data: PropTypes.array
-}
-
Message.propTypes = {
data: PropTypes.shape({
mid: PropTypes.number.isRequired,
- user: PropTypes.shape({
- uid: PropTypes.number.isRequired,
- uname: PropTypes.string.isRequired
- }),
+ user: UserType,
timestamp: PropTypes.string.isRequired,
body: PropTypes.string
})
};
+Tags.propTypes = {
+ data: PropTypes.array
+}
+