-
Notifications
You must be signed in to change notification settings - Fork 88
feat(sidebar): align with fusion ds #8145
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,49 +5,108 @@ import StyledIconButton from "../../../icon-button/icon-button.style"; | |
| import StyledIcon from "../../../icon/icon.style"; | ||
|
|
||
| const StyledSidebarHeader = styled.div.attrs(applyBaseTheme)<{ | ||
| hasClose?: boolean; | ||
| headerVariant?: "light" | "dark"; | ||
| $hasCloseButton?: boolean; | ||
| $headerVariant?: "typical" | "inverse" | "light" | "dark"; | ||
| $gradientKeyLine?: boolean; | ||
| }>` | ||
| background-color: ${({ headerVariant }) => | ||
| headerVariant === "light" | ||
| ? "var(--colorsUtilityYang100)" | ||
| : "var(--colorsUtilityYin100)"}; | ||
| box-shadow: inset 0 -1px 0 0 var(--colorsUtilityMajor100); | ||
| ${({ $headerVariant }) => { | ||
| const inverse = $headerVariant === "inverse" || $headerVariant === "dark"; | ||
|
|
||
| return css` | ||
| background-color: ${inverse | ||
| ? "var(--container-standard-inverse-bg-default)" | ||
| : "var(--container-standard-bg-default)"}; | ||
| color: ${inverse | ||
| ? "var(--container-standard-inverse-txt-default)" | ||
| : "var(--container-standard-txt-default)"}; | ||
| position: relative; | ||
| `; | ||
| }} | ||
| box-sizing: border-box; | ||
| flex: 0 0 auto; | ||
| min-height: calc((2 * var(--global-space-comp-xl)) + var(--global-size-s)); | ||
| width: 100%; | ||
| color: var(--colorsActionMinorYin090); | ||
| transition: all 0.2s ease; | ||
| padding: var(--global-space-comp-xl); | ||
| ${padding} | ||
| ${({ hasClose, headerVariant }) => | ||
| hasClose && | ||
| ${({ $hasCloseButton, $headerVariant }) => | ||
| $hasCloseButton && | ||
| css` | ||
| display: flex; | ||
| justify-content: space-between; | ||
| gap: var(--spacing200); | ||
| gap: var(--global-space-comp-l); | ||
|
Contributor
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. question: should this gap be the same for all sizes, or should we not be using the component size to dictate this gap?
Contributor
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. Same comment applies to other fixed size usages in the PR 👍
Contributor
Author
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. Let me double-check |
||
| > ${StyledIconButton}:first-of-type { | ||
| ${headerVariant === "dark" && | ||
| ${($headerVariant === "inverse" || $headerVariant === "dark") && | ||
| css` | ||
| ${StyledIcon} { | ||
| color: var(--colorsUtilityYang080); | ||
| color: var(--container-standard-inverse-txt-default); | ||
| } | ||
|
|
||
| &:is(:hover, :active, :focus) ${StyledIcon} { | ||
| color: var(--container-standard-inverse-txt-default); | ||
| } | ||
|
|
||
| &:disabled ${StyledIcon} { | ||
| color: var(--container-standard-inverse-txt-alt); | ||
| } | ||
| `} | ||
| align-self: flex-start; | ||
| border-radius: var(--global-radius-action-circle); | ||
| flex: 0 0 auto; | ||
| height: var(--global-size-s); | ||
| min-width: var(--global-size-s); | ||
| width: var(--global-size-s); | ||
|
|
||
| ${StyledIcon} { | ||
| height: var(--global-size-2-xs); | ||
| width: var(--global-size-2-xs); | ||
| } | ||
| } | ||
| `} | ||
| div[data-element="sidebar-heading"] { | ||
| display: flex; | ||
| flex: 1 1 auto; | ||
| flex-direction: column; | ||
| gap: var(--global-space-comp-xs); | ||
| min-width: 0; | ||
| width: 100%; | ||
|
|
||
| [data-element="sidebar-title"] { | ||
| color: inherit; | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| const StyledSidebarHeaderDivider = styled.hr.attrs(applyBaseTheme)<{ | ||
| $gradientKeyLine?: boolean; | ||
| }>` | ||
| background: ${({ $gradientKeyLine }) => | ||
| $gradientKeyLine | ||
| ? "var(--container-standard-border-ai-h)" | ||
| : "var(--container-standard-border-default)"}; | ||
| border: var(--global-borderwidth-none); | ||
| bottom: 0; | ||
| height: ${({ $gradientKeyLine }) => | ||
| $gradientKeyLine | ||
| ? "var(--global-borderwidth-s)" | ||
| : "var(--global-borderwidth-xs)"}; | ||
| left: 0; | ||
| margin: 0; | ||
| position: absolute; | ||
| right: 0; | ||
| `; | ||
|
|
||
| const StyledSidebarSubHeader = styled.div.attrs(applyBaseTheme)` | ||
| box-sizing: border-box; | ||
| width: 100%; | ||
| color: var(--colorsActionMinorYin090); | ||
| background-color: var(--colorsUtilityMajor050); | ||
| border-bottom: 1px solid var(--colorsUtilityMajor075); | ||
| color: var(--container-standard-txt-default); | ||
| background-color: var(--container-standard-bg-alt); | ||
| border-bottom: var(--global-borderwidth-xs) solid | ||
| var(--container-standard-border-default); | ||
| padding: var(--global-space-comp-s) var(--global-space-comp-2-xl); | ||
| ${padding} | ||
| transition: all 0.2s ease; | ||
| `; | ||
|
|
||
| export default StyledSidebarHeader; | ||
| export { StyledSidebarSubHeader }; | ||
| export { StyledSidebarHeaderDivider, StyledSidebarSubHeader }; | ||
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.
nitpick: you could do the ternary inside a template literal like so
var(--container-standard-${inverse ? "inverse" : ""}-bg-default)or something alone those lines to save a little bit of lines here, but what you have is fine and completely acceptable
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.
Suggestion as literally written looks broken) Consider inverse = false => var(--container-standard**--**bg-default). The hyphens catch an eye and I think we accidentally can invite a morse code into our CSS)
If you insist on change, I can introduce const variant suffix = inverse ? "-inverse" : "". Do you think it worth it?