Skip to content

Commit

Permalink
Update appbar height on appbar mount
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Feb 28, 2025
1 parent 7d029ac commit 4f4f2cd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/kolibri/components/pages/AppBarPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,16 @@
},
beforeUpdate() {
// Update appBarHeight after AppBar is rerendered and updated
this.handleWindowResize();
this.updateAppBarHeight();
},
mounted() {
this.updateAppBarHeight();
this.addScrollListener();
window.addEventListener('resize', this.handleWindowResize);
window.addEventListener('resize', this.updateAppBarHeight);
},
beforeDestroy() {
this.removeScrollListener();
window.removeEventListener('resize', this.handleWindowResize);
window.removeEventListener('resize', this.updateAppBarHeight);
},
methods: {
addScrollListener() {
Expand Down Expand Up @@ -189,7 +190,7 @@
this.throttledHandleScroll = null;
}
},
handleWindowResize() {
updateAppBarHeight() {
// Update the app bar height when window is resized
this.appBarHeight = this.$refs.appBar.$el.scrollHeight || 124;
},
Expand Down

0 comments on commit 4f4f2cd

Please sign in to comment.