Skip to content

Commit

Permalink
feat: Turn on Icon View of Sidebar when Tablet and Sticky Mode - MEED…
Browse files Browse the repository at this point in the history
…-7892 - Meeds-io/MIPs#159 (#4217)

This change will switch to icon mode when the resolution is under 1263
and more than 959 when the user had selected the 'STICKY' mode.
  • Loading branch information
boubaker authored and rdenarie committed Dec 9, 2024
1 parent b5d82bf commit 532a093
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export default {
}
},
closeMenuEffectively(force) {
if (force && this.mode === 'ICON') {
if (force && this.$root.icon) {
this.$root.hoverMenu = false;
this.$root.hoverThirdLevel = false;
this.$root.hoverSecondLevel = false;
Expand Down
23 changes: 13 additions & 10 deletions webapp/src/main/webapp/vue-apps/sidebar/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,26 @@ export function init(
ltr: eXo.env.portal.orientation === 'ltr',
},
computed: {
stickyBreakpointWidth() {
return this.mode === 'ICON' ? this.$vuetify.breakpoint.thresholds.md : this.$vuetify.breakpoint.thresholds.lg;
autoSwitchToIcon() {
return this.mode === 'STICKY'
&& this.allowIcon
&& (this.$vuetify.breakpoint.width >= this.$vuetify.breakpoint.thresholds.md)
&& (this.$vuetify.breakpoint.width < this.$vuetify.breakpoint.thresholds.lg);
},
stickyAllowed() {
return this.$vuetify.breakpoint.width >= this.stickyBreakpointWidth;
return this.$vuetify.breakpoint.width >= this.$vuetify.breakpoint.thresholds.md;
},
displaySequentially() {
return this.stickyAllowed;
},
hidden() {
return !this.stickyAllowed || this.mode === 'HIDDEN';
},
sticky() {
return !this.hidden && this.mode === 'STICKY';
return !this.hidden && (this.mode === 'STICKY' && !this.autoSwitchToIcon);
},
icon() {
return !this.hidden && (this.mode === 'ICON' || this.autoSwitchToIcon);
},
allowedModes() {
return this.settings?.allowedModes || [];
Expand All @@ -102,9 +111,6 @@ export function init(
allowHidden() {
return this.allowedModes.includes('HIDDEN');
},
icon() {
return !this.hidden && this.mode === 'ICON';
},
expand() {
return !this.icon || this.hoverDeferred;
},
Expand All @@ -114,9 +120,6 @@ export function init(
iconCollapse() {
return this.icon && !this.expand;
},
displaySequentially() {
return this.$vuetify.breakpoint.width >= this.stickyBreakpointWidth;
},
hover() {
return this.hoverMenu
|| this.hoverButton
Expand Down

0 comments on commit 532a093

Please sign in to comment.