@atlaskit/comment
Version:
A comment displays discussions and user feedback.
108 lines (107 loc) • 3.34 kB
JavaScript
/* header.tsx generated by @compiled/babel-plugin v3.0.2 */
import "./header.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import LockFilledIcon from '@atlaskit/icon/core/lock-locked';
import Lozenge from '@atlaskit/lozenge/lozenge';
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
const headingStyles = {
root: "_11c8fhey"
};
const iconWrapperStyles = {
root: "_18zrv77o _1e0c1txw"
};
const headerItemStyles = {
root: "_o5721q9c _1o9zidpf"
};
const authorBoxStyles = {
root: "_1nmz9jpi _1ul9idpf _p12f1osq"
};
/**
* __Header items__
*
* Comment header items.
*
* @internal
*/
const Header = ({
author,
edited,
isError,
isSaving,
restrictedTo,
savingText,
time,
testId,
type,
headingLevel = '3',
shouldHeaderWrap
}) => {
const Heading = `h${headingLevel}`;
const shouldRender = author || time || restrictedTo || isSaving && savingText || edited || type;
return shouldRender ? /*#__PURE__*/React.createElement(Heading, {
className: ax([headingStyles.root])
}, shouldHeaderWrap === false ? /*#__PURE__*/React.createElement(Inline, {
alignBlock: "center",
testId: testId,
space: "space.100",
as: "span",
shouldWrap: false
}, author, type && /*#__PURE__*/React.createElement(Lozenge, {
testId: testId && `${testId}-type`
}, type), time && !isSaving && !isError && time, edited || null, isSaving ? savingText : null, restrictedTo && /*#__PURE__*/React.createElement(Text, {
color: "color.text.subtlest"
}, /*#__PURE__*/React.createElement(Inline, {
alignBlock: "center",
space: "space.050",
as: "span"
}, "\u2022", /*#__PURE__*/React.createElement(Box, {
as: "span",
xcss: iconWrapperStyles.root
}, /*#__PURE__*/React.createElement(LockFilledIcon, {
color: "currentColor",
label: "",
size: "small"
})), restrictedTo))) : /*#__PURE__*/React.createElement(Inline, {
alignBlock: "center",
testId: testId,
space: "space.100",
rowSpace: "space.0",
as: "span",
shouldWrap: true
}, author && /*#__PURE__*/React.createElement(Box, {
as: "span",
xcss: authorBoxStyles.root
}, author), type && /*#__PURE__*/React.createElement(Box, {
as: "span",
xcss: headerItemStyles.root
}, /*#__PURE__*/React.createElement(Lozenge, {
testId: testId && `${testId}-type`
}, type)), time && !isSaving && !isError && /*#__PURE__*/React.createElement(Box, {
as: "span",
xcss: headerItemStyles.root
}, time), edited && /*#__PURE__*/React.createElement(Box, {
as: "span",
xcss: headerItemStyles.root
}, edited), isSaving && savingText && /*#__PURE__*/React.createElement(Box, {
as: "span",
xcss: headerItemStyles.root
}, savingText), restrictedTo && /*#__PURE__*/React.createElement(Box, {
as: "span"
}, /*#__PURE__*/React.createElement(Text, {
color: "color.text.subtlest"
}, /*#__PURE__*/React.createElement(Inline, {
alignBlock: "center",
space: "space.050",
as: "span"
}, /*#__PURE__*/React.createElement(Box, {
as: "span",
xcss: iconWrapperStyles.root
}, /*#__PURE__*/React.createElement(LockFilledIcon, {
color: "currentColor",
label: "",
size: "small"
})), restrictedTo))))) : null;
};
Header.displayName = 'CommentHeader';
export default Header;