Skip to content

Commit a746d89

Browse files
committed
refactor: 移除 IsPage 参数
1 parent 81589e1 commit a746d89

File tree

4 files changed

+67
-81
lines changed

4 files changed

+67
-81
lines changed

src/BootstrapBlazor.Server/Components/Layout/PageLayout.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</HeadContent>
77

88
<CascadingValue Value="this" IsFixed="true">
9-
<Layout SideWidth="0" IsPage="true" IsFullSide="@IsFullSide" IsFixedHeader="@IsFixedHeader" IsFixedFooter="@IsFixedFooter"
9+
<Layout SideWidth="0" IsFullSide="@IsFullSide" IsFixedHeader="@IsFixedHeader" IsFixedFooter="@IsFixedFooter"
1010
ShowFooter="@ShowFooter" ShowGotoTop="true" ShowCollapseBar="true" Menus="@Menus"
1111
UseTabSet="@UseTabSet" TabDefaultUrl="layout-page" AdditionalAssemblies="new[] { GetType().Assembly }" class="@LayoutClassString">
1212
<Header>

src/BootstrapBlazor/Components/Layout/Layout.razor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public partial class Layout : IHandlerException
108108
/// </summary>
109109
/// <remarks>为真时增加 is-page 样式</remarks>
110110
[Parameter]
111+
[Obsolete("已弃用,直接删除即可;Deprecated Please remove it")]
112+
[ExcludeFromCodeCoverage]
111113
public bool IsPage { get; set; }
112114

113115
/// <summary>
@@ -233,7 +235,6 @@ public partial class Layout : IHandlerException
233235
private string? ClassString => CssBuilder.Default("layout")
234236
.AddClass("is-collapsed", IsCollapsed)
235237
.AddClass("has-sidebar", Side != null && IsFullSide)
236-
.AddClass("is-page", IsPage)
237238
.AddClass("has-footer", ShowFooter && Footer != null)
238239
.AddClassFromAttributes(AdditionalAttributes)
239240
.Build();

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

Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -161,93 +161,91 @@
161161
}
162162
}
163163

164-
&.is-page {
165-
.has-sidebar {
166-
.layout-banner {
167-
display: none;
168-
}
169-
170-
.layout-main {
171-
width: 100%;
172-
}
164+
.has-sidebar {
165+
.layout-banner {
166+
display: none;
173167
}
174168

175-
.layout-right {
169+
.layout-main {
176170
width: 100%;
177171
}
172+
}
173+
174+
.layout-right {
175+
width: 100%;
176+
}
177+
178+
&.is-fixed {
179+
position: fixed;
180+
top: 0;
181+
bottom: 0;
182+
left: 0;
183+
right: 0;
184+
}
185+
186+
.layout-header {
187+
background-color: var(--bb-layout-header-background);
188+
height: var(--bb-layout-header-height);
189+
color: var(--bb-layout-header-color);
190+
display: flex;
191+
align-items: center;
192+
padding: 0 1rem;
193+
position: sticky;
194+
z-index: 1035;
195+
border-bottom: 1px solid var(--bb-layout-header-border-color);
178196

179197
&.is-fixed {
180-
position: fixed;
181198
top: 0;
182-
bottom: 0;
183-
left: 0;
184-
right: 0;
185199
}
186200

187-
.layout-header {
188-
background-color: var(--bb-layout-header-background);
189-
height: var(--bb-layout-header-height);
190-
color: var(--bb-layout-header-color);
191-
display: flex;
192-
align-items: center;
193-
padding: 0 1rem;
194-
position: sticky;
195-
z-index: 1035;
196-
border-bottom: 1px solid var(--bb-layout-header-border-color);
201+
.widget {
202+
--bb-widget-toggle-color: var(--bb-layout-header-color);
197203

198-
&.is-fixed {
199-
top: 0;
204+
.progress {
205+
height: 7px;
200206
}
207+
}
201208

202-
.widget {
203-
--bb-widget-toggle-color: var(--bb-layout-header-color);
209+
.logout-avatar {
210+
border-radius: 50%;
211+
}
204212

205-
.progress {
206-
height: 7px;
207-
}
208-
}
213+
.dropdown-logout {
214+
--bb-logout-text-color: var(--bb-layout-header-color);
215+
--bb-logout-user-bg: var(--bb-layout-menu-user-banner-background);
216+
--bb-logout-menu-border-color: var(--bb-layout-menu-user-border-color);
209217

210-
.logout-avatar {
218+
.dropdown-user img {
211219
border-radius: 50%;
212220
}
213-
214-
.dropdown-logout {
215-
--bb-logout-text-color: var(--bb-layout-header-color);
216-
--bb-logout-user-bg: var(--bb-layout-menu-user-banner-background);
217-
--bb-logout-menu-border-color: var(--bb-layout-menu-user-border-color);
218-
219-
.dropdown-user img {
220-
border-radius: 50%;
221-
}
222-
}
223221
}
222+
}
224223

225-
.layout-menu {
226-
.menu {
227-
--bb-menu-item-hover-bg: var(--bb-layout-menu-item-hover-bg);
228-
}
224+
.layout-menu {
225+
.menu {
226+
--bb-menu-item-hover-bg: var(--bb-layout-menu-item-hover-bg);
229227
}
228+
}
230229

231-
.layout-main {
232-
padding: 1rem;
233-
position: relative;
234-
min-height: calc(100vh - var(--bb-layout-header-height) - var(--bb-layout-footer-height));
235-
}
230+
.layout-main {
231+
padding: 1rem;
232+
position: relative;
233+
min-height: calc(100vh - var(--bb-layout-header-height) - var(--bb-layout-footer-height));
234+
}
236235

237-
.layout-footer {
238-
height: var(--bb-layout-footer-height);
239-
color: var(--bb-layout-footer-color);
240-
background-color: var(--bb-layout-footer-background);
241-
display: flex;
242-
align-items: center;
243-
padding: 0 1rem;
244-
border-top: 1px solid var(--bs-border-color);
245-
246-
&.is-fixed {
247-
z-index: 1035;
248-
position: sticky;
249-
bottom: 0;
250-
}
236+
.layout-footer {
237+
height: var(--bb-layout-footer-height);
238+
color: var(--bb-layout-footer-color);
239+
background-color: var(--bb-layout-footer-background);
240+
display: flex;
241+
align-items: center;
242+
padding: 0 1rem;
243+
border-top: 1px solid var(--bs-border-color);
244+
245+
&.is-fixed {
246+
z-index: 1035;
247+
position: sticky;
248+
bottom: 0;
251249
}
252250
}
253251
}

test/UnitTest/Components/LayoutTest.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,6 @@ await cut.InvokeAsync(() =>
9999
cut.WaitForAssertion(() => Assert.DoesNotContain("<i class=\"fa-solid fa-bars\"></i>", cut.Markup));
100100
}
101101

102-
[Fact]
103-
public void IsPage_OK()
104-
{
105-
var cut = Context.RenderComponent<Layout>(pb =>
106-
{
107-
pb.Add(a => a.IsPage, true);
108-
});
109-
Assert.Contains("is-page", cut.Markup);
110-
111-
cut.SetParametersAndRender(pb => pb.Add(a => a.IsPage, false));
112-
cut.WaitForAssertion(() => Assert.DoesNotContain("is-page", cut.Markup));
113-
}
114-
115102
[Fact]
116103
public void IsFullSide_OK()
117104
{

0 commit comments

Comments
 (0)