Skip to content

Commit

Permalink
feature: sticky legend group header (#1909)
Browse files Browse the repository at this point in the history
* Sticky header

* slidefix

* Update group.js
  • Loading branch information
jokd authored Dec 4, 2023
1 parent 39a43aa commit 5f37c34
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions scss/ui/_slidenav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
box-sizing: border-box;
display: inline-block;
line-height: 0;
overflow: hidden;
position: relative;
transition: height 0.3s;

>.main {
box-sizing: border-box;
display: inline-block;
left: 0;
overflow: hidden;
position: relative;
top: 0;
transition: all 0.3s;
Expand All @@ -35,9 +33,11 @@
width: 100%;
will-change: transform;
z-index: 1000;
height: unset;

&.absolute {
position: absolute;
height: 0;
}
}

Expand Down Expand Up @@ -70,5 +70,7 @@
opacity: 1;
transform: none;
}

overflow: hidden
}
}
4 changes: 4 additions & 0 deletions scss/ui/helpers/_helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
overflow-y: auto;
}

.overflow-unset {
overflow: unset;
}

// position
.absolute {
position: absolute;
Expand Down
6 changes: 3 additions & 3 deletions src/controls/legend/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ const Group = function Group(viewer, options = {}) {

const GroupHeader = function GroupHeader() {
const headerComponent = CollapseHeader({
cls: 'hover padding-x padding-y-small grey-lightest border-bottom text-small item wrap',
cls: 'hover padding-x padding-y-small grey-lightest border-bottom text-small sticky bg-white z-index-low item wrap',
style: `top: 0;${moreInfoButton ? 'padding-right: 0.275rem' : ''}`,
icon,
title,
style: `${moreInfoButton ? 'padding-right: 0.275rem' : ''}`
title
});
if (moreInfoButton) {
headerComponent.on('render', function hcRender() {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/slidenav.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default function Slidenav(options = {}) {
getState,
onInit() {
mainContainer = Element({
cls: 'main'
cls: 'main overflow-unset'
});
backButton = Button({
cls: 'icon-small padding-small',
Expand Down

0 comments on commit 5f37c34

Please sign in to comment.