[EuiComment] 🛑 WIP Create styles header and border for EuiCommentEvent#7253
[EuiComment] 🛑 WIP Create styles header and border for EuiCommentEvent#7253breehall wants to merge 6 commits intoelastic:mainfrom
EuiCommentEvent#7253Conversation
…eader color to the entire comment header, not just the text background color
…e the color toggling
EuiCommentHeaderEuiCommentEvent
EuiCommentEventEuiCommentEvent
|
Hey Andrea & Trevor, do you all mind taking a look at the the change made to You can test this in Storybook by visiting the |
|
@breehall I think we need darker colors for the borders. |
|
@breehall I think I lean toward option 1 for accessibility and visual interest. The higher contrast of the border makes the header more prominent and keeps us on the safe side of WCAG SC 1.4.11: Non-text contrast (AA). I did a thought experiment where I mocked up an alert with each of the brand color tints and full-strength border, then ran them through the axe-core browser plugin. We had zero contrast issues, and the strong borders really gave each their own character.
|
|
@andreadelrio Here are a few more options in
|
Thanks a lot! I'm partial to something between 0.3 and 0.5. I'd have to see all the other color variants to make a final recommendation. |
|
@andreadelrio Here's a version of a comment with each color and each transparatize level to assist. |
|
@breehall this is super helpful thank you! My vote would be for 0.5. However, I feel like the |
Yep, we totally do (e.g. success and accent colors for buttons). I think this is a warranted case. One note - I'm slightly concerned by us using |
- Create DRY style helper for border styles - Update styling conditions in CommentEvent to add a matching border when eventColor is passed in and the comment is of the *regular* type
…r event borders for testing
EuiCommentEventEuiCommentEvent
|
@andreadelrio Do you mind going to the docs staging for EuiComment and let me know what you think about these colors? Feel free to toggle between light and dark as well. I realized the changes look different in images because I've zoomed out in my browser, so the colors in the images don't 100% reflect the code change. Staging: https://eui.elastic.co/pr_7253/#/display/comment-list#basic-comment-list |
@breehall I just checked it out, I like it! Question, what are the differences between |
@andreadelrio A quick check in Kibana showed |
| euiCommentEvent__header: css``, | ||
| // types | ||
| regular: css` | ||
| background: ${euiTheme.colors.lightestShade}; |
There was a problem hiding this comment.
@breehall could we get rid of this and add a default eventColor to this component instead?
There was a problem hiding this comment.
I actually think this might be better than adding the color as a component default. The reason I say this is because a background is only set on type regular.
The other two types (custom and update) don't have a background color. So we would be setting the default, and then unsetting if the type is custom or update instead of the above approach which is setting the background color only for type regular or applying the eventColor if needed.
|
EuiComment has changed a ton since I last contributed to it so I'm not clear on all the inner workings of it. Having said that, my take is that we only need one gray color (which could be |
Below is the logic we currently have. If an event color is passed view This means we have // The 'plain' color creates a shadow and adds a border radius that we don't want.
// So for these cases we use the transparent color instead.
const finalEventColor = eventColor === 'plain' ? 'transparent' : eventColor; |
…olors for event borders for testing" This reverts commit e5341a2.
| return `1px solid ${tintOrShade( | ||
| euiTheme.colors.accent, | ||
| ratio, | ||
| colorMode |
There was a problem hiding this comment.
I tried to DRY this out by simply returning (1px solid ${tintOrShade(euiTheme.colors[color], ratio, colorMode) to avoid logic inside of the switch, but that made TypeScript angry.
| custom: css``, | ||
| }); | ||
| const _generateEventBorderColor = ( | ||
| { euiTheme, colorMode }: UseEuiTheme, |
There was a problem hiding this comment.
This function accepts colorMode on the chance that we need different color ratios for light and dark mode, but if the 0.6 ratio is OK for both, we can get rid of it.
| hasEventColor: css` | ||
| padding: 0; | ||
| `, | ||
| border: { |
There was a problem hiding this comment.
border doesn't need to be its own object if you'd prefer to leave the colors as a direct child of the main styling object. I felt like it was easier to contain these styles in border{} so we're aware that these only apply to borders.
|
Preview staging links for this PR:
|
💚 Build Succeeded
History
|
|
Closing in favor of #7288 |








#7238
Summary
This PR extends the
eventColorprop onEuiCommentEventand applies the color to the entire comment header, not just the panel included inside of the header.Before

After

QA
eventColorprop within the Playground forEuiCommentEvent-> https://eui.elastic.co/pr_7253/storybook/index.html?path=/story/euicommentevent--playgroundGeneral checklist
@defaultif default values are missing) and playground toggles