[EuiCommentList] Convert to Emotion, allow custom children and new event props#6030
[EuiCommentList] Convert to Emotion, allow custom children and new event props#6030elizabetdev merged 15 commits intoelastic:mainfrom
Emotion, allow custom children and new event props#6030Conversation
custom children and new event propsEmotion, allow custom children and new event props
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6030/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6030/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6030/ |
chandlerprall
left a comment
There was a problem hiding this comment.
Initial review for src-docs changes.
One suggested change doesn't fit the PR feedback format well, so I've opened a PR for that one - elizabetdev#30
Should eventColor=plain cause this drop shadow?
src-docs/src/views/notification_event/notification_event_example.js
Outdated
Show resolved
Hide resolved
…_flexible [comment flexible example] remove 'any' type usage
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6030/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6030/ |
Co-authored-by: Chandler Prall <chandler.prall@gmail.com>
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6030/ |
|
Thanks, @chandlerprall. I went through your review and pushed 7e31abc and 2bc273f. Let me know if there is anything missing. |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6030/ |

Summary
This PR adds new props and other enhancements to
EuiCommentList/EuiComment. Part of the discussions that led to these enhancements can be found here: #5692.Other enhancements are a result of our consumer's feedback on the usage of this component:
This is the Figma file where you can find all the research and design ideas:
https://www.figma.com/file/OlPQKfamN8WzA7jT7dI16z/CommentList?node-id=0%3A1
Converted to
EmotionThe
EuiCommentListandEuiCommentwere updated to useEuiTimelineandEuiTimelineItemrespectively. So this reduces a lot of the custom styles. At the end, there was only one component that required custom styles and it was converted to emotion:comment_event.styles.tsCustom children
Now consumers can add custom components without the
usernameand a panel appearing.New props
New props
eventIcon,eventIconAriaLabel, andeventColor:Also, a new
gutterSizeprop which is inherited fromEuiTimelinewas added.Timeline icon
The
timelineIconis now only for avatars. To display an icon for an update/event consumers should be using the neweventIconprop.If no
timelineIconis provided, it will default to theusername'sinitials. Before this update, thetimelineIconwas defaulting to auseravatar. Using avatars withusername'sinitials makes more sense for a comment list because it makes it easier to distinguish different users by initials/colors.EuiComment.actions now accepts
ReactNode[]Updated
EuiComment.actionstype to acceptReactNode[]New docs examples
Two new section were added to the docs:
Breaking changes
EuiCommentEvent.usernametype fromReactNodetostringThe reason for that is that now the timeline icon defaults to an avatar with an initial username letter. So we need to make sure the username is a string to pass to theEuiAvatar.name.EuiCommentListandEuiCommentto useEuiTimelineandEuiTimelineItemrespectively. This change makes theEuiCommentListto be always required. It also improves the a11y by using better semantic elements (ol > li)EuiComment.type. It is no longer required to say what is thetypeof comment. The comment is now flexible enough and adapts to the props passed.Checklist
Checked Code Sandbox works for any docs examplesChecked for accessibility including keyboard-only and screenreader modes