@atlaskit/comment
Version:
A comment displays discussions and user feedback.
84 lines (83 loc) • 2.15 kB
JavaScript
/* comment.tsx generated by @compiled/babel-plugin v3.0.2 */
import _extends from "@babel/runtime/helpers/extends";
import "./comment.compiled.css";
import { ax, ix } from "@compiled/react/runtime";
import React from 'react';
import { cx } from '@atlaskit/css';
import { Box, Stack } from '@atlaskit/primitives/compiled';
import Footer from './footer';
import Header from './header';
import CommentLayout from './layout';
const textStyles = {
root: "_syazi7uo",
disabled: "_syaz1gmx"
};
/**
* __Comment__
*
* Comments enable discussions on an entity such as a page, blog post, work item, or pull request.
*/
const Comment = ({
actions = [],
restrictedTo = '',
highlighted = false,
isSaving = false,
savingText = 'Sending...',
isError = false,
errorActions = [],
errorIconLabel = '',
author,
avatar,
children,
content,
edited,
time,
type,
testId,
id,
afterContent,
shouldRenderNestedCommentsInline,
headingLevel = '3',
shouldHeaderWrap
}) => {
const headerProps = {
author,
edited,
isError,
isSaving,
restrictedTo,
savingText,
time,
type,
headingLevel,
shouldHeaderWrap
};
const footerProps = {
actions,
errorActions,
errorIconLabel,
isError,
isSaving
};
return /*#__PURE__*/React.createElement(CommentLayout, {
testId: testId,
shouldRenderNestedCommentsInline: shouldRenderNestedCommentsInline,
id: id,
avatar: avatar,
content: /*#__PURE__*/React.createElement(Stack, {
space: "space.075"
}, /*#__PURE__*/React.createElement(Stack, {
space: "space.050"
}, /*#__PURE__*/React.createElement(Header, _extends({
testId: testId && `${testId}-header`
}, headerProps)), /*#__PURE__*/React.createElement(Box, {
testId: testId && `${testId}-content`,
xcss: cx(textStyles.root, (isSaving || isError) && textStyles.disabled)
}, content)), /*#__PURE__*/React.createElement(Footer, _extends({
testId: testId && `${testId}-footer`
}, footerProps)), afterContent),
highlighted: highlighted
}, children);
};
Comment.displayName = 'Comment';
export default Comment;