Make bottom sticky room list header dynamic
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
12034411d4
commit
7fd6d4498f
2 changed files with 9 additions and 4 deletions
|
@ -59,10 +59,6 @@ limitations under the License.
|
||||||
width: calc(100% - 22px);
|
width: calc(100% - 22px);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.mx_RoomSublist_headerContainer_stickyBottom {
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't have a top style because the top is dependent on the room list header's
|
// We don't have a top style because the top is dependent on the room list header's
|
||||||
// height, and is therefore calculated in JS.
|
// height, and is therefore calculated in JS.
|
||||||
// The class, mx_RoomSublist_headerContainer_stickyTop, is applied though.
|
// The class, mx_RoomSublist_headerContainer_stickyTop, is applied though.
|
||||||
|
|
|
@ -210,10 +210,19 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
if (!header.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")) {
|
if (!header.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")) {
|
||||||
header.classList.add("mx_RoomSublist_headerContainer_stickyBottom");
|
header.classList.add("mx_RoomSublist_headerContainer_stickyBottom");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const offset = window.innerHeight - (list.parentElement.offsetTop + list.parentElement.offsetHeight);
|
||||||
|
const newBottom = `${offset}px`;
|
||||||
|
if (header.style.bottom !== newBottom) {
|
||||||
|
header.style.bottom = newBottom;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (header.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")) {
|
if (header.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")) {
|
||||||
header.classList.remove("mx_RoomSublist_headerContainer_stickyBottom");
|
header.classList.remove("mx_RoomSublist_headerContainer_stickyBottom");
|
||||||
}
|
}
|
||||||
|
if (header.style.bottom) {
|
||||||
|
header.style.removeProperty('bottom');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.stickyTop || style.stickyBottom) {
|
if (style.stickyTop || style.stickyBottom) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue