Skip to content

Commit b1dc225

Browse files
committed
refactor: 支持 Layout 收缩状态
1 parent 790190c commit b1dc225

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

src/BootstrapBlazor/Components/Layout/Layout.razor.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
}
8585

8686
.has-sidebar {
87-
/*left-right*/
8887
position: relative;
8988
flex: 1;
9089

@@ -267,14 +266,17 @@
267266
position: relative;
268267
width: var(--bb-layout-sidebar-width);
269268
transform: translateX(0);
270-
transition: width .3s linear;
271269
flex-shrink: 0;
272270

273271
.layout-menu {
274272
border-right: 1px solid var(--bs-border-color);
275273
}
276274
}
277275

276+
&:not(.drag) .layout-side {
277+
transition: width .3s linear;
278+
}
279+
278280
&.has-sidebar {
279281
.layout-side {
280282
&.is-fixed-header {

src/BootstrapBlazor/Components/Layout/LayoutSplitebar.razor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function init(id) {
1515
let width = 0;
1616
Drag.drag(bar,
1717
e => {
18-
bar.classList.add('drag')
18+
section.classList.add('drag')
1919
width = parseInt(getComputedStyle(section).getPropertyValue('--bb-layout-sidebar-width'))
2020
originX = e.clientX || e.touches[0].clientX
2121
},
@@ -32,7 +32,7 @@ export function init(id) {
3232
section.style.setProperty('--bb-layout-sidebar-width', `${newWidth}px`)
3333
},
3434
e => {
35-
bar.classList.remove('drag')
35+
section.classList.remove('drag')
3636
}
3737
)
3838
}

src/BootstrapBlazor/Components/Layout/LayoutSplitebar.razor.scss

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,25 @@
1818
transition: background .3s linear;
1919

2020
&:hover {
21-
background-color: var(--bb-sidebar-body-hover-bg);
21+
background-color: var(--bb-splitebar-body-hover-bg);
2222
}
23+
}
24+
}
2325

24-
&.drag,
25-
&.drag:hover {
26-
background-color: var(--bb-sidebar-body-drag-hover-bg);
26+
.drag {
27+
.layout-splitebar {
28+
.layout-splitebar-body:hover {
29+
background-color: var(--bb-splitebar-body-drag-hover-bg);
2730
}
2831
}
2932
}
3033

34+
.is-collapsed {
35+
.layout-splitebar-body {
36+
display: none;
37+
}
38+
}
39+
3140
@media(min-width: 768px) {
3241
.layout-splitebar {
3342
display: block;

0 commit comments

Comments
 (0)