zcash-grant-system/frontend/client/components/Profile/ProfileComment.tsx

38 lines
1.0 KiB
TypeScript
Raw Normal View History

import React from 'react';
import { Link } from 'react-router-dom';
import moment from 'moment';
2018-10-04 21:27:02 -07:00
import { UserComment } from 'types';
2019-03-05 09:35:40 -08:00
import Markdown from 'components/Markdown';
import { MARKDOWN_TYPE } from 'utils/markdown';
import './ProfileComment.less';
interface OwnProps {
comment: UserComment;
userName: string;
}
export default class Profile extends React.Component<OwnProps> {
render() {
const {
userName,
comment: { content, proposal, dateCreated },
} = this.props;
return (
<div className="ProfileComment">
<div className="ProfileComment-head">
<span className="ProfileComment-head-name">{userName}</span> commented on{' '}
<Link
to={`/proposals/${proposal.proposalId}`}
className="ProfileComment-head-proposal"
>
{proposal.title}
</Link>{' '}
{moment(dateCreated * 1000).from(Date.now())}
</div>
2019-03-05 09:35:40 -08:00
<Markdown source={content} type={MARKDOWN_TYPE.REDUCED} />
</div>
);
}
}