Skip to content

Commit 6b2bd0b

Browse files
committed
fix(layout): sidebar on mobile issue
re: [#23](coreui/coreui-angular#23)
1 parent 4fd3b0b commit 6b2bd0b

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

scss/_layout.scss

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77
}
88

9-
// stylelint-disable selector-type-no-unknown, no-duplicate-selectors, selector-no-qualifying-type
9+
// stylelint-disable selector-type-no-unknown, no-duplicate-selectors, selector-no-qualifying-type, selector-max-combinators
1010
// app-dashboard and app-root are Angular2+ selectors. You can add here your own selectors if you need.
1111
.app,
1212
app-dashboard,
@@ -167,7 +167,6 @@ html[dir="rtl"] {
167167
//
168168
// Aside Menu
169169
//
170-
171170
.aside-menu-fixed {
172171
.aside-menu {
173172
position: fixed;
@@ -239,11 +238,12 @@ html[dir="rtl"] {
239238
@include media-breakpoint-up($breakpoint) {
240239
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
241240
html:not([dir="rtl"]) {
242-
.sidebar#{$infix}-show {
241+
.sidebar#{$infix}-show,
242+
.sidebar-show {
243243
.sidebar {
244244
margin-left: 0;
245245
}
246-
@if media-breakpoint-up(sm) {
246+
@if $breakpoint != "xs" {
247247
&.sidebar-fixed {
248248
.main,
249249
.app-footer {
@@ -258,7 +258,7 @@ html[dir="rtl"] {
258258
&.sidebar-minimized {
259259
.main,
260260
.app-footer {
261-
margin-left: $sidebar-minimized-width;
261+
margin-left: if($breakpoint != "lg" and $breakpoint != "xl", $sidebar-width, $sidebar-minimized-width);
262262
}
263263
}
264264
}
@@ -280,11 +280,12 @@ html[dir="rtl"] {
280280
}
281281
}
282282

283+
.aside-menu-show,
283284
.aside-menu#{$infix}-show {
284285
.aside-menu {
285286
margin-right: 0;
286287
}
287-
@if media-breakpoint-up(sm) {
288+
@if $breakpoint != "xs" {
288289
&.aside-menu-fixed {
289290
.main,
290291
.app-footer {
@@ -301,11 +302,12 @@ html[dir="rtl"] {
301302
}
302303

303304
html[dir="rtl"] {
304-
.sidebar#{$infix}-show {
305+
.sidebar#{$infix}-show,
306+
.sidebar-show {
305307
.sidebar {
306308
margin-right: 0;
307309
}
308-
@if media-breakpoint-up(sm) {
310+
@if $breakpoint != "xs" {
309311
&.sidebar-fixed {
310312
.main,
311313
.app-footer {
@@ -320,7 +322,7 @@ html[dir="rtl"] {
320322
&.sidebar-minimized {
321323
.main,
322324
.app-footer {
323-
margin-right: $sidebar-minimized-width;
325+
margin-right: if($breakpoint != "lg" and $breakpoint != "xl", $sidebar-width, $sidebar-minimized-width);
324326
}
325327
}
326328
}
@@ -342,11 +344,12 @@ html[dir="rtl"] {
342344
}
343345
}
344346

347+
.aside-menu-show,
345348
.aside-menu#{$infix}-show {
346349
.aside-menu {
347350
margin-left: 0;
348351
}
349-
@if media-breakpoint-up(sm) {
352+
@if $breakpoint != "xs" {
350353
&.aside-menu-fixed {
351354
.main,
352355
.app-footer {
@@ -361,26 +364,29 @@ html[dir="rtl"] {
361364
}
362365
}
363366
}
367+
364368
.sidebar#{$infix}-show,
365369
.aside-menu#{$infix}-show {
366370
@keyframes opacity {
367371
0% { opacity: 0; }
368372
100% { opacity: 1; }
369373
}
370374

371-
@include media-breakpoint-down(xs) {
372-
.main {
373-
position: relative;
374-
&::before {
375-
position: absolute;
376-
top: 0;
377-
left: 0;
378-
z-index: $zindex-sticky - 2;
379-
width: 100%;
380-
height: 100%;
381-
content: "";
382-
background: rgba(0, 0, 0, .7);
383-
animation: opacity $layout-transition-speed;
375+
@if $breakpoint == "xs" {
376+
@include media-breakpoint-down(xs) {
377+
.main {
378+
position: relative;
379+
&::before {
380+
position: absolute;
381+
top: 0;
382+
left: 0;
383+
z-index: $zindex-sticky - 2;
384+
width: 100%;
385+
height: 100%;
386+
content: "";
387+
background: rgba(0, 0, 0, .7);
388+
animation: opacity $layout-transition-speed;
389+
}
384390
}
385391
}
386392
}
@@ -426,7 +432,6 @@ html[dir="rtl"] {
426432
//
427433
// Mobile layout
428434
//
429-
430435
@include media-breakpoint-down(md) {
431436
.app-header {
432437
position: fixed;

0 commit comments

Comments
 (0)