You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-04 11:51:45 +03:00
Make bottom sticky room list header dynamic
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user