diff --git a/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor b/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor
index 507146aa844..ef2ce092a08 100644
--- a/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor
+++ b/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor
@@ -10,9 +10,7 @@
-
+
diff --git a/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor.css b/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor.css
index 88763b3961d..ba65bb28d5f 100644
--- a/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor.css
+++ b/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor.css
@@ -2,10 +2,6 @@
padding: var(--bb-main-pading);
}
-.section {
- --bb-sidebar-width: 0;
-}
-
.sidebar-title {
height: 50px;
align-items: center;
@@ -78,18 +74,24 @@
@media (min-width: 768px) {
.section {
- --bb-sidebar-width: 300px;
+ --bb-layout-sidebar-width: 300px;
display: flex;
flex-direction: row;
-webkit-font-smoothing: antialiased;
}
+ .main {
+ flex: 1;
+ width: 1%;
+ min-width: 0;
+ }
+
.sidebar-title {
display: flex;
}
.sidebar {
- width: var(--bb-sidebar-width);
+ width: var(--bb-layout-sidebar-width);
height: calc(100vh);
position: sticky;
top: 0;
@@ -97,10 +99,6 @@
margin-top: calc(var(--bs-header-height) * -1);
}
- .main {
- width: calc(100% - var(--bb-sidebar-width));
- }
-
.sidebar-bar {
display: block;
}
diff --git a/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js b/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js
index 854cefcec85..c9a462db93b 100644
--- a/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js
+++ b/src/BootstrapBlazor.Server/Components/Layout/NavMenu.razor.js
@@ -1,12 +1,10 @@
import Data from "../../_content/BootstrapBlazor/modules/data.js"
-import Drag from "../../_content/BootstrapBlazor/modules/drag.js"
import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js"
export function init(id) {
const navmenu = {
navbar: document.querySelector('.navbar-toggler'),
- menu: document.querySelector('.sidebar-content'),
- bar: document.querySelector('.sidebar-body')
+ menu: document.querySelector('.sidebar-content')
}
Data.set(id, navmenu)
@@ -20,27 +18,6 @@ export function init(id) {
navmenu.menu.classList.remove('show')
}
})
- let originX = 0
- let section = document.querySelector('section');
- let width = 0
- Drag.drag(navmenu.bar,
- e => {
- navmenu.bar.classList.add('drag')
- width = parseInt(getComputedStyle(section).getPropertyValue('--bb-sidebar-width'))
- originX = e.clientX || e.touches[0].clientX
- },
- e => {
- const eventX = e.clientX || (e.touches.length > 0 && e.touches[0].clientX)
- const moveX = eventX - originX
- const newWidth = width + moveX
- if (newWidth >= 250 && newWidth <= 380) {
- section.style.setProperty('--bb-sidebar-width', `${newWidth}px`)
- }
- },
- e => {
- navmenu.bar.classList.remove('drag')
- }
- )
}
export function dispose(id) {
@@ -49,5 +26,4 @@ export function dispose(id) {
EventHandler.off(data.navbar, 'click');
EventHandler.off(data.menu, 'click', '.nav-link');
- Drag.dispose(data.bar)
}
diff --git a/src/BootstrapBlazor/Components/Layout/Layout.razor b/src/BootstrapBlazor/Components/Layout/Layout.razor
index 4084ac060d7..a8fc664ee77 100644
--- a/src/BootstrapBlazor/Components/Layout/Layout.razor
+++ b/src/BootstrapBlazor/Components/Layout/Layout.razor
@@ -22,16 +22,7 @@
}
else if (IsFullSide)
{
-
+ @RenderSide
@if (Header != null)
{
@@ -51,16 +42,7 @@
@RenderHeader(ShowCollapseBar)
}
@if (ShowFooter && Footer != null)
@@ -100,6 +82,22 @@
@Header
;
+ RenderFragment RenderSide =>
+ @;
+
RenderFragment RenderMenu =>
@