-
Notifications
You must be signed in to change notification settings - Fork 0
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
Proposed minor CSS variable cleanup #8
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
pointer-events: none; | ||
visibility: hidden; | ||
position: fixed; | ||
top: var(--kbnAppHeadersOffset, 0); | ||
top: var(--kbnAppHeadersOffset, var(--euiFixedHeadersOffset, 0)); | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
|
@@ -38,18 +38,11 @@ | |
.kbnBody { | ||
padding-top: var(--euiFixedHeadersOffset, 0); | ||
} | ||
|
||
// Conditionally override :root CSS fixed header variable. Updating `--euiFixedHeadersOffset` | ||
// on the body will cause all child EUI components to automatically update their offsets | ||
.kbnBody--projectActionMenuVisible { | ||
--kbnAppHeadersOffset: calc(var(--kbnHeaderOffset) + var(--kbnProjectHeaderAppActionMenuHeight)); | ||
} | ||
.kbnBody--hasHeaderBanner { | ||
--euiFixedHeadersOffset: var(--kbnHeaderOffsetWithBanner); | ||
--kbnAppHeadersOffset: var(--kbnHeaderOffsetWithBanner); | ||
|
||
&.kbnBody--projectActionMenuVisible { | ||
--kbnAppHeadersOffset: calc(var(--kbnHeaderOffsetWithBanner) + var(--kbnProjectHeaderAppActionMenuHeight)); | ||
} | ||
|
||
// Offset fixed EuiHeaders by the top banner | ||
.euiHeader[data-fixed-header] { | ||
|
@@ -63,15 +56,24 @@ | |
} | ||
} | ||
|
||
// Set a body CSS variable for the app container to use - calculates the total | ||
// height of all fixed headers + the sticky action menu toolbar | ||
.kbnBody--projectActionMenuVisible { | ||
Comment on lines
+59
to
+61
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. I pulled this out to its own selector block instead of bogarting the other existing selectors because I thought it was easier to read and understand separately. If the toolbar goes away or changes its positioning logic someday, separating it also makes it easier to delete all at once |
||
--kbnAppHeadersOffset: calc(var(--kbnHeaderOffset) + var(--kbnProjectHeaderAppActionMenuHeight)); | ||
|
||
&.kbnBody--hasHeaderBanner { | ||
--kbnAppHeadersOffset: calc(var(--kbnHeaderOffsetWithBanner) + var(--kbnProjectHeaderAppActionMenuHeight)); | ||
} | ||
} | ||
|
||
.kbnBody--chromeHidden { | ||
--euiFixedHeadersOffset: 0; | ||
&.kbnBody--projectActionMenuVisible { | ||
--kbnAppHeadersOffset: 0; | ||
|
||
&.kbnBody--hasHeaderBanner { | ||
--euiFixedHeadersOffset: var(--kbnHeaderBannerHeight); | ||
} | ||
} | ||
.kbnBody--chromeHidden.kbnBody--hasHeaderBanner { | ||
--euiFixedHeadersOffset: var(--kbnHeaderBannerHeight); | ||
|
||
&.kbnBody--projectActionMenuVisible { | ||
--kbnAppHeadersOffset: var(--kbnHeaderBannerHeight); | ||
--kbnAppHeadersOffset: var(--euiFixedHeadersOffset, 0); | ||
} | ||
Comment on lines
76
to
78
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. This I kept in the |
||
} |
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.
Removing this from
:root
is a minor cleanup preference. IMO, this variable only needs to get set on the appropriate body modifier. Other CSS can conditionally use either this variable or--euiFixedHeadersOffset
if present by simply nestingvar()
fallbacks:kibana/src/core/public/styles/rendering/_base.scss
Line 22 in 9fc3c18