-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Table] Refactor header menus to divorce click-target size from gradient size #906
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 |
---|---|---|
|
@@ -51,7 +51,24 @@ | |
} | ||
} | ||
|
||
.bp-table-th-menu { | ||
.bp-table-th-menu-container { | ||
flex-shrink: 0; | ||
position: absolute; | ||
right: $cell-border-width; // don't overlap box-shadow border | ||
opacity: 0; // hide until header is hovered | ||
text-align: right; | ||
|
||
.bp-table-header:hover &, | ||
.bp-table-header-active & { | ||
opacity: 1; | ||
} | ||
|
||
.bp-table-interaction-bar & { | ||
line-height: $interaction-bar-height; | ||
} | ||
} | ||
|
||
.bp-table-th-menu-container-background { | ||
@function menu-background($color) { | ||
@return linear-gradient(90deg, rgba($color, 0) 0%, $color 50%); | ||
} | ||
|
@@ -65,18 +82,39 @@ | |
mix($pt-intent-primary, $dark-header-hover-background-color, 10%) | ||
); | ||
|
||
flex-shrink: 0; | ||
position: absolute; | ||
top: 0; | ||
right: $cell-border-width; // don't overlap box-shadow border | ||
opacity: 0; // hide until header is hovered | ||
background: none; | ||
right: 0; | ||
width: $column-header-min-height + $pt-grid-size * 2; | ||
height: $column-header-min-height; | ||
pointer-events: none; // don't swallow clicks meant for the underlying header cell | ||
|
||
.bp-table-header:hover &, | ||
.bp-table-header-active & { | ||
background-image: $menu-hover-background; | ||
|
||
.pt-dark & { | ||
background-image: $dark-menu-hover-background; | ||
} | ||
} | ||
|
||
.bp-table-header.bp-table-header-selected & { | ||
background-image: $menu-selected-background; | ||
|
||
.pt-dark & { | ||
background-image: $dark-menu-selected-background; | ||
} | ||
} | ||
|
||
.bp-table-interaction-bar & { | ||
height: $interaction-bar-height; | ||
} | ||
} | ||
|
||
.bp-table-th-menu { | ||
cursor: $action-cursor; | ||
width: $column-header-min-height + $pt-grid-size; | ||
width: $column-header-min-height; // create a larger, more accessible click target | ||
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 don't think comment means much, and will mean even less in a month. it doesn't even look correct when i compare with code on the left, where the width was obviously larger. 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. fair, though in general i like quick little CSS comments explaining the intent behind a rule. regardless of the target size prior to this refactor, this element's purpose is still to create a larger click target than the |
||
height: $column-header-min-height; | ||
padding-right: $pt-grid-size / 2 + $cell-border-width * 2; // icon has a border | ||
text-align: right; | ||
pointer-events: all; | ||
|
||
.bp-table-interaction-bar & { | ||
right: $cell-border-width; | ||
|
@@ -94,12 +132,18 @@ | |
} | ||
|
||
.pt-icon-standard { | ||
$icon-offset: ($column-header-min-height - $pt-icon-size-standard) / 2; | ||
|
||
margin-top: $icon-offset; | ||
margin-right: $icon-offset; | ||
border-radius: $pt-border-radius; | ||
box-shadow: inset 0 0 0 1px rgba($black, $pt-drop-shadow-opacity); | ||
background-color: $header-hover-background-color; | ||
color: $pt-icon-color; | ||
|
||
.pt-dark & { | ||
box-shadow: inset 0 0 0 1px rgba($white, $pt-drop-shadow-opacity); | ||
background-color: $dark-header-hover-background-color; | ||
color: $pt-dark-icon-color; | ||
} | ||
} | ||
|
@@ -125,24 +169,6 @@ | |
color: $white; | ||
} | ||
} | ||
|
||
.bp-table-header:hover &, | ||
.bp-table-header-active & { | ||
opacity: 1; | ||
background-image: $menu-hover-background; | ||
|
||
.pt-dark & { | ||
background-image: $dark-menu-hover-background; | ||
} | ||
} | ||
|
||
.bp-table-header.bp-table-header-selected & { | ||
background-image: $menu-selected-background; | ||
|
||
.pt-dark & { | ||
background-image: $dark-menu-selected-background; | ||
} | ||
} | ||
} | ||
|
||
.bp-table-thead { | ||
|
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.
shouldn't need flex properties if you're using
position: absolute
but whateverThere 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.
yeah i wasn't actually sure what this rule was doing (i'm no flex expert), but it was there before, so i left it in the refactor.