Skip to content

Commit d072a52

Browse files
szaimennextcloud-command
authored andcommitted
appsidebar should be compact when opened on small heights
Signed-off-by: Simon L <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
1 parent 0a5b3d0 commit d072a52

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

apps/files/src/views/Sidebar.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export default {
112112
fileInfo: null,
113113
starLoading: false,
114114
isFullScreen: false,
115+
hasLowHeight: false,
115116
}
116117
},
117118
@@ -226,7 +227,7 @@ export default {
226227
'app-sidebar--has-preview': this.fileInfo.hasPreview && !this.isFullScreen,
227228
'app-sidebar--full': this.isFullScreen,
228229
},
229-
compact: !this.fileInfo.hasPreview || this.isFullScreen,
230+
compact: this.hasLowHeight || !this.fileInfo.hasPreview || this.isFullScreen,
230231
loading: this.loading,
231232
starred: this.fileInfo.isFavourited,
232233
subtitle: this.subtitle,
@@ -484,6 +485,16 @@ export default {
484485
handleClosed() {
485486
emit('files:sidebar:closed')
486487
},
488+
handleWindowResize() {
489+
this.hasLowHeight = document.documentElement.clientHeight < 1024
490+
},
491+
},
492+
created() {
493+
window.addEventListener('resize', this.handleWindowResize)
494+
this.handleWindowResize()
495+
},
496+
beforeDestroy() {
497+
window.removeEventListener('resize', this.handleWindowResize)
487498
},
488499
}
489500
</script>

0 commit comments

Comments
 (0)