댓글
댓글 (Comment)
댓글은 사용자들이 작성한 의견과 토론을 표시하는 컴포넌트예요. 작성자, 시간, 콘텐츠, 아바타, 그리고 답글처럼 중첩된 댓글까지 담아 낼 수 있어요.
출처: 문서
본문
Comment 컴포넌트
댓글과 토론을 표시하는 컴포넌트예요.
- 키워드: comment, discussion, thread, conversation, chat
- 카테고리: data-display
- 상태: general-availability
예시
import Comment from '@atlaskit/comment/comment';
const Example = (): React.JSX.Element => (
<Comment
author="Bob Johnson"
time="30 minutes ago"
content="Another comment in the thread"
avatar="https://picsum.photos/32/32"
/>
);
export default Example;
Props
| Prop | Type | Description |
|---|---|---|
actions |
React.ReactNode[] |
A list of CommentAction items rendered as a row of buttons below the content |
afterContent |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
Content that is rendered after the comment's content |
author |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
A CommentAuthor element containing the name of the author |
avatar |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
The element to display as the avatar (required) |
children |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
Provide nested comments as children |
content |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
The main content for the comment |
edited |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
A CommentEdited element which displays next to the time |
errorActions |
React.ReactNode[] |
A list of CommentAction items rendered with a warning icon instead of the actions |
errorIconLabel |
string |
Text to show in the error icon label |
headingLevel |
"1" | "3" | "2" | "4" | "5" | "6" |
Use this to set the semantic heading level of the comment |
highlighted |
boolean |
Sets whether this comment should be highlighted |
id |
string |
An ID to be applied to the comment |
isError |
boolean |
Indicates whether the component is in an error state |
isSaving |
boolean |
Enables "optimistic saving" mode which removes actions and displays text from the savingText prop |
restrictedTo |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
Text for the "restricted to" label |
savingText |
string |
Text to show when in "optimistic saving" mode |
shouldHeaderWrap |
boolean |
Controls if the comment header should wrap |
shouldRenderNestedCommentsInline |
boolean |
Controls if nested comments are rendered at the same depth as the parent comment |
time |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
A CommentTime element containing the time to display |
type |
string |
The type of comment |
사용 지침
- 댓글 스레드와 토론에 사용해요
- 명확한 댓글 작성자 표시를 제공해요
- 댓글 중첩을 적절히 처리해요
- 댓글 중재 기능을 고려해요
콘텐츠 지침
- 명확하고 건설적인 댓글 콘텐츠를 사용해요
- 의미 있는 댓글 작성자 정보를 제공해요
- 적절한 댓글 서식을 사용해요
- 댓글의 맥락과 목적을 고려해요
접근성 지침
- 적절한 댓글 구조를 보장해요
- 명확한 댓글 작성자 표시를 제공해요
- 적절한 제목 계층을 사용해요
- 스크린 리더 탐색을 고려해요