Skip to content

Commit

Permalink
Allow sidebar toggling on wide slideouts
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 17, 2024
1 parent d7c3cba commit f7253a5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/css/cp.css.map

Large diffs are not rendered by default.

11 changes: 1 addition & 10 deletions src/web/assets/cp/src/css/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,6 @@ ul.icons {
width: 36px;
}

&.active,
&.loading {
cursor: default;
}
Expand Down Expand Up @@ -5475,15 +5474,7 @@ $min2ColWidth: 400px;

@container (width > 700px) {
.slideout {
&.has-sidebar {
.pane-header:not(.so-visible) {
display: none;
}

.sidebar-btn {
display: none;
}

&.showing-sidebar {
.so-body {
display: flex;
flex-direction: row;
Expand Down
12 changes: 10 additions & 2 deletions src/web/assets/cp/src/js/CpScreenSlideout.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
}

if (data.sidebar) {
this.$container.addClass('has-sidebar');
this.$sidebarBtn.removeClass('hidden');
this.$sidebar.html(data.sidebar);

Expand All @@ -340,8 +339,15 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
});

this.hasSidebar = true;

// is the slideout wide enough to show it alongside the content?
if (this.$container.width() > 700) {
this.showSidebar();
} else {
this.hideSidebar();
}
} else {
this.$container.removeClass('has-sidebar');
this.hideSidebar();
this.$sidebarBtn.addClass('hidden');
this.$sidebar.addClass('hidden').html('');
this.hasSidebar = false;
Expand Down Expand Up @@ -407,6 +413,7 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
return;
}

this.$container.addClass('showing-sidebar');
this.$body.scrollTop(0).addClass('no-scroll');

this.$sidebar
Expand Down Expand Up @@ -447,6 +454,7 @@ Craft.CpScreenSlideout = Craft.Slideout.extend(
return;
}

this.$container.removeClass('showing-sidebar');
this.$body.removeClass('no-scroll');

this.$sidebar
Expand Down

0 comments on commit f7253a5

Please sign in to comment.