-
Notifications
You must be signed in to change notification settings - Fork 833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Emotion] Convert global className
utilities
#6124
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c88f1ea
Convert text globals/utilities to Emotion
cee-chen 28d626b
Pass euiTheme to globalStyles and convert euiNumberFormat
cee-chen b1d25fa
Convert display utils to Emotion
cee-chen 5c2d5ef
Document euiFullHeight under scroll utils
cee-chen 48fe87f
Convert scroll globals to Emotion (+ add logical CSS properties)
cee-chen a557e69
Convert .eui-isFocusable global to Emotion
cee-chen 3f4187e
Convert responsive globals to Emotion
cee-chen ab32f6f
Add snapshot test for quick checking of global styles output
cee-chen 3e288c0
Changelog
cee-chen 626c66f
Remove `.eui-isFocusable` - not being used anywhere
cee-chen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,10 +81,10 @@ export const euiBreadcrumbContentStyles = (euiThemeContext: UseEuiTheme) => { | |
// Types | ||
page: css` | ||
&:is(a):focus { | ||
${euiFocusRing(euiTheme, 'inset')}; | ||
${euiFocusRing(euiThemeContext, 'inset')}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much better! 🥳 |
||
} | ||
&:is(button):focus { | ||
${euiFocusRing(euiTheme, 'center')}; | ||
${euiFocusRing(euiThemeContext, 'center')}; | ||
} | ||
`, | ||
application: css` | ||
|
@@ -109,7 +109,7 @@ export const euiBreadcrumbContentStyles = (euiThemeContext: UseEuiTheme) => { | |
color: ${euiTheme.colors.link}; | ||
|
||
:focus { | ||
${euiFocusRing(euiTheme, 'inset')}; | ||
${euiFocusRing(euiThemeContext, 'inset')}; | ||
|
||
:focus-visible { | ||
border-radius: ${euiTheme.border.radius.medium}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import { | |
euiBreakpoint, | ||
euiScrollBarStyles, | ||
logicalCSS, | ||
logicalCSSWithFallback, | ||
logicalSizeCSS, | ||
} from '../../global_styling'; | ||
import { UseEuiTheme } from '../../services'; | ||
|
@@ -34,8 +35,7 @@ export const euiGlobalToastListStyles = (euiThemeContext: UseEuiTheme) => { | |
${logicalCSS('bottom', 0)}; | ||
${logicalCSS('width', `${euiToastWidth + euiTheme.base * 5}px`)}; /* 2 */ | ||
${logicalCSS('max-height', '100vh')}; /* 1 */ | ||
overflow-y: auto; // Fallback for the 'overflow-inline' logical property, which is not yet supported | ||
${logicalCSS('overflow-y', 'auto')}; | ||
${logicalCSSWithFallback('overflow-y', 'auto')}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a great idea. 🥳 |
||
|
||
// Hide the scrollbar entirely | ||
scrollbar-width: none; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something that we need to decide as a team. We normally document the hooks instead of the function versions. But I use much more functions than hooks. Why? Because in
component.styles.ts
we can't use hooks.If we search for
useEuiShadow
we find 0 usages in EUI. ButeuiShadow
is being used multiple times. So I wonder if we should be documenting both functions and hooks or prefer documenting the functions rather than hooks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our docs are consumer facing, so we document the hooks because we expect consumers to be using hooks more than passing our
euiThemeContext
around. Internally in EUI we pass our theme around a lot, but consumers are much less likely to do so, so they'll probably just want a hook that handles getting the theme for them.TBH, this is kind of an architectural choice we made too when setting up our Emotion styles pattern. We could have decided to make all our styles files/functions hooks instead, e.g.
useEuiComponentStyles()
which then allows us to call hook utils of all our styles instead of having to passeuiTheme
around manually. But then hooks can't be called conditionally or in callbacks, so there's pros/cons to everything.cc @thompsongl for more thoughts