2018-09-10 09:55:26 -07:00
|
|
|
import React from 'react';
|
|
|
|
import moment from 'moment';
|
2018-09-13 14:05:36 -07:00
|
|
|
import Markdown from 'components/Markdown';
|
2018-09-10 09:55:26 -07:00
|
|
|
import { Comment as IComment } from 'modules/proposals/reducers';
|
|
|
|
import * as Styled from './styled';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
comment: IComment;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class Comment extends React.Component<Props> {
|
|
|
|
public render(): React.ReactNode {
|
|
|
|
const { comment } = this.props;
|
|
|
|
return (
|
|
|
|
<Styled.Container>
|
|
|
|
<Styled.Info>
|
|
|
|
<Styled.InfoThumb src={comment.author.avatar['120x120']} />
|
|
|
|
<Styled.InfoName>{comment.author.username}</Styled.InfoName>
|
|
|
|
<Styled.InfoTime>
|
|
|
|
{moment(comment.dateCreated * 1000).fromNow()}
|
|
|
|
</Styled.InfoTime>
|
|
|
|
</Styled.Info>
|
|
|
|
|
|
|
|
<Styled.Body>
|
|
|
|
<Markdown source={comment.body} />
|
|
|
|
</Styled.Body>
|
|
|
|
|
|
|
|
<Styled.Controls>
|
|
|
|
<Styled.ControlButton>Reply</Styled.ControlButton>
|
|
|
|
{/*<Styled.ControlButton>Report</Styled.ControlButton>*/}
|
|
|
|
</Styled.Controls>
|
|
|
|
|
|
|
|
{comment.replies && (
|
|
|
|
<Styled.Replies>
|
|
|
|
{comment.replies.map(reply => (
|
|
|
|
<Comment key={reply.commentId} comment={reply} />
|
|
|
|
))}
|
|
|
|
</Styled.Replies>
|
|
|
|
)}
|
|
|
|
</Styled.Container>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|