Files
frontend-app-discussions/src/discussions/comments/comment/CommentHeader.jsx
Kshitij Sobti c8c3bb925c feat: Improve UX to match new mockups
Uses new API features for preview, deleting, pinning, and closing. Refactors and improves styling to match new mockups.
Adds the new post filter bar element.
2021-10-28 16:43:28 +05:30

45 lines
1.3 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { injectIntl } from '@edx/frontend-platform/i18n';
import { Avatar } from '@edx/paragon';
import { ThreadType } from '../../../data/constants';
import { AuthorLabel } from '../../common';
import ActionsDropdown from '../../common/ActionsDropdown';
import { selectAuthorAvatars } from '../../posts/data/selectors';
import { commentShape } from './proptypes';
function CommentHeader({
comment,
postType,
actionHandlers,
}) {
const authorAvatars = useSelector(selectAuthorAvatars(comment.author));
return (
<div className="d-flex flex-row justify-content-between">
<div className="align-items-center d-flex flex-row">
<Avatar className="m-2" alt={comment.author} src={authorAvatars?.imageUrlSmall} />
<AuthorLabel author={comment.author} authorLabel={comment.authorLabel} />
</div>
<ActionsDropdown
commentOrPost={{
...comment,
postType,
}}
actionHandlers={actionHandlers}
/>
</div>
);
}
CommentHeader.propTypes = {
comment: commentShape.isRequired,
actionHandlers: PropTypes.objectOf(PropTypes.func).isRequired,
postType: PropTypes.oneOf([ThreadType.QUESTION, ThreadType.DISCUSSION]).isRequired,
};
export default injectIntl(CommentHeader);