Consolidate EuiText and EuiMarkdownFormat styling#4663
Consolidate EuiText and EuiMarkdownFormat styling#4663elizabetdev merged 41 commits intoelastic:masterfrom
Conversation
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
cchaos
left a comment
There was a problem hiding this comment.
❤️ I know this was a lot of work, especially the relative sizing and custom coloring. I see a lot of duplicated mixin/functions but I'm not to worried about "DRY" code at the moment because I'm really hoping Emotion will make this easier in the near future.
There are definitely a few changes to the margins/paddings/line-heights of certain text elements. It would be great to track these in a comment so that we can show the intentionality of the changes and to know exactly what has changed.
One specific formatting thing that I'm seeing with the Markdown formatter, is that is only seems to be wrapping multi-line code blocks with our actual EuiCodeBlock (not inline). It would be great that even just single line code blocks could be wrapped in EuiCodeBlock.

src/themes/eui-amsterdam/global_styling/variables/_typography.scss
Outdated
Show resolved
Hide resolved
| ) : ( | ||
| <EuiCode {...props} /> | ||
| ), | ||
| // When we use block code "fences" the code tag is replaced by the `EuiCodeBlock`. |
There was a problem hiding this comment.
I don't expect any trouble, but for visibility, #4970 also edited this file and will likely merge first.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
@cchaos I went through your comments and I fixed all of them expect the following one:
Right now this part of the code checks if there are linebreaks to use code block or otherwise inline code. I can use the technique mentioned here: rehypejs/rehype-react#6 (comment). If the props contain a But I tried and if consumers don't pass a language like So not sure how can we better solve this issue. Ideally, if it's passed triple backticks with or without a language it should use a EuiCodeBlock otherwise EuiCode. But I couldn't find better solutions. @thompsongl any idea on how we can solve this? |
|
Does that mean that |
|
I think the problem starts before. When the code gets to This seems a good solution: rehypejs/rehype-react#6 (comment). Somehow we need to inject a class property at the node in order to distinguish inline/fenced code. So when it gets to |
|
Latest commit fixes the inline (single tick) vs. fenced (triple tick) code block discrepancy. |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
cchaos
left a comment
There was a problem hiding this comment.
💯 LGTM! I still think it's a good idea to track the differences in the text element renders. For instance the blockquote text size has been reduced. (I think it looks better, but others might not realize).
Maybe you can also update the home_view link to the new Getting Started page? 😉
I'd like an engineer to do a quick pass and then don't forget to merge with upstream to get changelog changes.
|
cc @gjones You'll want to watch for this one coming downstream after it merges. We utilize the |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
|
@cchaos I confirmed if all the margins, paddings, line-heights and font-sizes were matching the old sizes: https://github.com/elastic/eui/blob/master/src/components/text/_text.scss It seems that I only changed blockquotes to match the base font-size/line-height. I added a CL entry with this change and updated the PR summary. |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4663/ |
thompsongl
left a comment
There was a problem hiding this comment.
Code changes LGTM! Thanks for all the work on this 🙏
|
Thanks @thompsongl and @cchaos for the help! 🎉 |
Summary
This PR is a first step in making the EuiMarkdownFormat use the EuiText. So the EuiText improvements were thought in a way to benefit the EuiMarkdownFormat usage.
So given the complexity of this PR, we should improve issues like bottom margins of EUI components inside the EuiText in a different PR.
Or we should open a feature branch just to tackle styling issues that exist in the EuiText or in components when they live inside the EuiText. But I would say that this PR closes #4145.
Render markdown files in our docs
More components with Remark
Scale text mixin
The
euiScaleTextmixing had some changes:$sizingMethodthat can beemorrem.fontSizeToRemOrEm($size, $sizingMethod: 'rem').marginToRemOrEm($elementSize, $elementFontSize, $sizingMethod: 'rem').line-heightused to returnremnow returns unitless numbers. This way, it behaves the same for bothremandemfont-size scenarios.EuiText
relative. This works for scenarios where we want to scale the font.EuiMarkdownFormat styles
Text, Borders, and backgrounds change according to the color passed. They can also inherit or receive any EUI named color.
With this approach, I don't see the reason for having a
reverseColorsFromThemeor acolorMethodthat accepts solid or translucent as an option.The decision of the color passed is on the consumer implementation. By knowing the theme context, consumers can pass colors that make sense. Also, the
colorprop acceptsrgbacolors for translucent scenarios.Pages to test the new functionalities:
Checklist
[ ] Checked in mobile[ ] Checked Code Sandbox works for the any docs examples[ ] Checked for breaking changes and labeled appropriately[ ] Checked for accessibility including keyboard-only and screenreader modes