-
Notifications
You must be signed in to change notification settings - Fork 156
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
fix: Fix visual bugs in drawer toggle buttons #1343
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 |
---|---|---|
|
@@ -8,14 +8,9 @@ | |
|
||
// Toggle should have 40px width, whereas button is 26px wide. | ||
// 40 - 26 = 14px in total or 7px on each side | ||
$toggle-padding-horizontal: 0.7 * styles.$base-size; | ||
$toggle-padding-vertical: awsui.$space-xxs; | ||
$toggle-padding: $toggle-padding-vertical $toggle-padding-horizontal; | ||
|
||
// New styles for when there are drawers | ||
$drawers-padding-horizontal: 0.6 * styles.$base-size; | ||
$drawers-padding-vertical: awsui.$space-scaled-xs; | ||
$drawers-padding: $drawers-padding-vertical $drawers-padding-horizontal; | ||
$_toggle-padding-horizontal: 0.7 * styles.$base-size; | ||
$_toggle-padding-vertical: awsui.$space-xxs; | ||
Comment on lines
+11
to
+12
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. Prefix a variable with underscore makes it available only inside the current file |
||
$toggle-padding: $_toggle-padding-vertical $_toggle-padding-horizontal; | ||
|
||
$sidebar-size-closed: 4 * styles.$base-size; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
@use '../../internal/styles/tokens' as awsui; | ||
@use '../../internal/styles' as styles; | ||
@use '../../internal/hooks/focus-visible' as focus-visible; | ||
@use '../constants' as constants; | ||
|
||
// should be above sticky notifications | ||
|
@@ -29,7 +31,6 @@ $drawer-z-index-mobile: 1001; | |
} | ||
&-closed { | ||
min-width: constants.$sidebar-size-closed; | ||
cursor: pointer; | ||
&.drawer-mobile { | ||
display: none; | ||
} | ||
|
@@ -48,13 +49,11 @@ $drawer-z-index-mobile: 1001; | |
} | ||
.drawer-closed > & { | ||
width: constants.$sidebar-size-closed; | ||
&:hover { | ||
background: awsui.$color-background-layout-panel-hover; | ||
} | ||
&.non-interactive { | ||
&.drawer-content-clickable { | ||
cursor: pointer; | ||
color: awsui.$color-text-interactive-default; | ||
Comment on lines
+52
to
+54
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. Made some refactoring in this file to more clearly connect styles and their reasons. Why is there a pointer cursor? Not because the drawer is closed, but because it is clickable 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. There could be closed non-clickable drawers and the new CSS structure allows that |
||
&:hover { | ||
background: awsui.$color-background-layout-panel-content; | ||
cursor: default; | ||
background: awsui.$color-background-layout-panel-hover; | ||
} | ||
} | ||
} | ||
|
@@ -63,34 +62,26 @@ $drawer-z-index-mobile: 1001; | |
} | ||
} | ||
|
||
.trigger { | ||
.drawer-content > .drawer-triggers > & { | ||
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. Before this PR, app layout used our button component and this line overrode button styles. Overriding styles is bad even if done for a good reason, it still may cause issues. In this PR I replaced it with custom styles on top of native |
||
background: awsui.$color-background-layout-toggle-default; | ||
border: 0; | ||
border-radius: 0; | ||
color: awsui.$color-text-layout-toggle; | ||
padding: constants.$drawers-padding-vertical awsui.$space-s; | ||
margin-top: 1px; | ||
|
||
&:not(:last-child) { | ||
box-shadow: 0px 1px awsui.$color-shadow-layout-toggle; | ||
} | ||
&-drawer { | ||
&:hover:not(.selected) { | ||
color: awsui.$color-text-layout-toggle-hover; | ||
&:not(:last-child) { | ||
box-shadow: 0px 1px awsui.$color-shadow-layout-toggle; | ||
} | ||
} | ||
} | ||
.drawer-triggers-wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
text-align: center; | ||
align-items: stretch; | ||
} | ||
|
||
&.selected, | ||
&.selected:hover { | ||
background-color: awsui.$color-background-layout-toggle-selected-default; | ||
border-top: 1px solid awsui.$color-background-layout-toggle-selected-default; | ||
box-shadow: none; | ||
color: awsui.$color-text-layout-toggle-active; | ||
margin: 0; | ||
} | ||
.drawer-trigger { | ||
padding: constants.$toggle-padding; | ||
cursor: pointer; | ||
color: awsui.$color-text-interactive-default; | ||
&:not(:first-child) { | ||
border-top: 1px solid awsui.$color-border-layout; | ||
} | ||
&:hover { | ||
color: awsui.$color-text-layout-toggle-hover; | ||
} | ||
&-active, | ||
&-active:hover { | ||
background-color: awsui.$color-background-layout-toggle-selected-default; | ||
color: awsui.$color-text-layout-toggle-active; | ||
} | ||
} |
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.
:nth-child
does not work anymore, because every button has a wrapper now.Since this feature is not in production yet, we can do such breaking changes