[Emotion] Convert EuiBottomBar to Emotion#5823
Conversation
Merge Changes from EUI Main
Merging in the latest code from eui/main
Merging in the latest code from main
Merging in the latest code from the main branch
Pulling in the latest code from the main branch
…ottom_bar Pulling in code from main
…ottom_bar Merging in the latest code from the main branch
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5823/ |
EuiBottomBar to Emotion
… that wraps the original inside of EuiThemeProvider to pass the dark theme to the entire component. Removed the shouldRenderCustomStyles test utility
| // Base | ||
| euiBottomBar: css` | ||
| ${euiShadowFlat(euiTheme, undefined, colorMode)}; | ||
| background: ${euiTheme.colors.lightShade}; |
There was a problem hiding this comment.
We still need this background color to render as it did previously. The sass variable is:
$euiHeaderDarkBackgroundColor: lightOrDarkTheme(shade($euiColorDarkestShade, 28%), shade($euiColorLightestShade, 50%)) !default;But since we're only ever in dark theme, we just need to apply the second parameter as the color:
| background: ${euiTheme.colors.lightShade}; | |
| background: ${shade(euiTheme.colors.lightestShade, .5)}; |
| color: ${euiTheme.colors.text}; | ||
| animation: ${euiBottomBarAppear} ${euiTheme.animation.slow} | ||
| ${euiTheme.animation.resistance}; | ||
| z-index: ${_euiBottomBarZHeader - 2}; |
There was a problem hiding this comment.
I just pushed the z-index layering global theme vars to main.
| z-index: ${_euiBottomBarZHeader - 2}; | |
| z-index: ${euiTheme.levels.header - 2}; |
There was a problem hiding this comment.
Hm, it looks like this z-index should also only apply if the position is fixed or sticky.
| //const _euiBottomBarColor = '#131317'; | ||
| const _euiBottomBarZHeader = 1000; |
There was a problem hiding this comment.
So neither of these should be needed anymore.
| //const _euiBottomBarColor = '#131317'; | |
| const _euiBottomBarZHeader = 1000; |
| } | ||
|
|
||
| 100% { | ||
| transform: translateY(00%); |
There was a problem hiding this comment.
| transform: translateY(00%); | |
| transform: translateY(0%); |
| className | ||
| ); | ||
|
|
||
| const cssStyles = [ |
There was a problem hiding this comment.
I added styles[position] back to the cssStyles array because I need to access the position to determine if the z-index should be added to the bottom bar. Since I already need it for that purpose, should we just attach the position styling in those style blocks instead of passing it in directly here?
|
Jenkins, test this |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5823/ |
cchaos
left a comment
There was a problem hiding this comment.
🙌 Our first dark-theme only component!
Just to compare using already converted components (Avatar, HR, LoadingChart) rendered inside the bottom bar:
LGTM. I tested in the 3 browsers and mobile. Gonna tag @thompsongl in on this one to ensure the wrapping component stuff is all what he expected.
| export const EuiBottomBar = forwardRef<HTMLElement, EuiBottomBarProps>( | ||
| (props, ref) => { | ||
| const BottomBar = _EuiBottomBar; | ||
| return ( | ||
| <EuiThemeProvider colorMode={'dark'}> | ||
| <BottomBar ref={ref} {...props} /> | ||
| </EuiThemeProvider> | ||
| ); | ||
| } | ||
| ); |
There was a problem hiding this comment.
Can you document this as a pattern for color-mode specific components in the Emotion styling wiki???
thompsongl
left a comment
There was a problem hiding this comment.
Just a couple nits. Nice work!
|
|
||
| export const euiBottomBarStyles = ({ euiTheme, colorMode }: UseEuiTheme) => ({ | ||
| // Base | ||
| //Text color needs to be reapplied to properly scope the forced `colorMode` |
There was a problem hiding this comment.
| //Text color needs to be reapplied to properly scope the forced `colorMode` | |
| // Text color needs to be reapplied to properly scope the forced `colorMode` |
| import { UseEuiTheme } from '../../services'; | ||
| import { shade } from '../../services/color'; |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5823/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5823/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5823/ |
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5823/ |


Summary
Converts
EuiBottomBarto EmotionAdditional changes include converting the original
EuiBottomBarfunction into an internal utility component that is nested inside of a new component that wraps the the bottom bar in anEuiThemeProvider. This was done to lay the ground work for future enhancements.Future enhancements include resolving #4158 by using
colorMode: inverseon the bottom bar. This will ensure that the bottom bar always stands out in light mode and in dark mode because the background color of the bar will always be in contrast to the color mode.This will also include adding a prop to
EuiBottomBarthat will consumers to chooselightordarkas thecolorModefor the bottom bar. If this prop is in use, thecolorMode: inverseenhancement (mentioned above) will not take affect.These enhancements will come at a later time to reduce the amount of disruption for consumers. The
colorModechanges will affect the background color of the bottom bar, but until other components have been converted to Emotion, these changes will be out of sync.Testing Note
With the changes made, the background color of
EuiBottomBarshould be a dark gray (euiTheme.colors.lightShade) in both light and dark mode. Previous, the background color was white.Things to look out for when moving styles
Use gap property to add margin between items if using flexCan any still existing .js files be converted to TS?QA
Checklist