Skip to content

Commit 3d9c15b

Browse files
committed
refactor: change --cui-sidebar-occupy to --cui-sidebar-occupy-start and add --cui-sidebar-occupy-end
1 parent dc06098 commit 3d9c15b

File tree

2 files changed

+40
-27
lines changed

2 files changed

+40
-27
lines changed

scss/sidebar/_sidebar-narrow.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,23 @@
5151

5252
.sidebar-narrow {
5353
@extend %sidebar-narrow;
54-
~ * {
55-
--#{$variable-prefix}sidebar-occupy: #{$sidebar-narrow-width};
54+
&:not(.sidebar-end) ~ * {
55+
--#{$variable-prefix}sidebar-occupy-start: #{$sidebar-narrow-width};
56+
}
57+
&.sidebar-end ~ * {
58+
--#{$variable-prefix}sidebar-occupy-end: #{$sidebar-narrow-width};
5659
}
5760
}
5861

5962
.sidebar-narrow-unfoldable {
6063
position: fixed;
6164
z-index: $zindex-fixed + 1;
6265

63-
~ * {
64-
--#{$variable-prefix}sidebar-occupy: #{$sidebar-narrow-width};
66+
&:not(.sidebar-end) ~ * {
67+
--#{$variable-prefix}sidebar-occupy-start: #{$sidebar-narrow-width};
68+
}
69+
&.sidebar-end ~ * {
70+
--#{$variable-prefix}sidebar-occupy-end: #{$sidebar-narrow-width};
6571
}
6672

6773
&:not(:hover) {

scss/sidebar/_sidebar.scss

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414
box-shadow: none;
1515
@include transition($sidebar-transition);
1616

17-
~ * {
18-
--#{$variable-prefix}sidebar-occupy: #{$sidebar-width};
19-
}
20-
21-
// + [data-coreui-reliant="sidebar"] {
22-
// @include transition($sidebar-reliant-transition);
23-
// }
24-
2517
@include media-breakpoint-down($mobile-breakpoint) {
2618
// Some of our components use this property to detect if the sidebar has mobile behavior.
2719
--#{$variable-prefix}is-mobile: true;
@@ -32,24 +24,32 @@
3224

3325
&:not(.sidebar-end){
3426
@include ltr-rtl("left", 0);
27+
~ * {
28+
--#{$variable-prefix}sidebar-occupy-start: 0;
29+
}
3530
}
3631
&.sidebar-end {
3732
@include ltr-rtl("right", 0);
33+
~ * {
34+
--#{$variable-prefix}sidebar-occupy-end: 0;
35+
}
3836
}
3937

40-
~ * {
41-
--#{$variable-prefix}sidebar-occupy: 0;
42-
}
4338
}
4439

4540
&:not(.sidebar-end){
4641
@include ltr-rtl("margin-left", 0);
42+
~ * {
43+
--#{$variable-prefix}sidebar-occupy-start: #{$sidebar-width};
44+
}
4745
}
4846

4947
&.sidebar-end {
5048
order: 99;
5149
@include ltr-rtl("margin-right", 0);
52-
50+
~ * {
51+
--#{$variable-prefix}sidebar-occupy-end: #{$sidebar-width};
52+
}
5353
}
5454

5555
&[class*="bg-"] {
@@ -59,13 +59,15 @@
5959
&.hide {
6060
&:not(.sidebar-end){
6161
@include ltr-rtl("margin-left", - $sidebar-width);
62+
~ * {
63+
--#{$variable-prefix}sidebar-occupy-start: 0;
64+
}
6265
}
6366
&.sidebar-end {
6467
@include ltr-rtl("margin-right", - $sidebar-width);
65-
}
66-
67-
~ * {
68-
--#{$variable-prefix}sidebar-occupy: 0;
68+
~ * {
69+
--#{$variable-prefix}sidebar-occupy-end: 0;
70+
}
6971
}
7072
}
7173

@@ -74,15 +76,17 @@
7476
flex: 0 0 $value;
7577
width: $value;
7678

77-
~ * {
78-
--#{$variable-prefix}sidebar-occupy: #{$value};
79-
}
80-
8179
&:not(.sidebar-end).hide {
8280
@include ltr-rtl("margin-left", - $value);
81+
~ * {
82+
--#{$variable-prefix}sidebar-occupy-start: #{$value};
83+
}
8384
}
8485
&.sidebar-end.hide {
8586
@include ltr-rtl("margin-right", - $value);
87+
~ * {
88+
--#{$variable-prefix}sidebar-occupy-end: #{$value};
89+
}
8690
}
8791
}
8892
}
@@ -260,6 +264,9 @@
260264
@include ltr-rtl("margin-left", - $value);
261265
}
262266
}
267+
~ * {
268+
--#{$variable-prefix}sidebar-occupy-start: 0;
269+
}
263270
}
264271
&.sidebar-end {
265272
@include ltr-rtl("margin-right", - $sidebar-width);
@@ -269,9 +276,9 @@
269276
@include ltr-rtl("margin-right", - $value);
270277
}
271278
}
272-
}
273-
~ * {
274-
--#{$variable-prefix}sidebar-occupy: 0;
279+
~ * {
280+
--#{$variable-prefix}sidebar-occupy-end: 0;
281+
}
275282
}
276283
}
277284
}

0 commit comments

Comments
 (0)