Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Layout): enhance layout styles #4679

Merged
merged 65 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3fc4ca4
doc: 代码格式化
ArgoZhang Nov 15, 2024
100824b
refactor: 移除空属性
ArgoZhang Nov 15, 2024
f5ef2c8
refactor: 重新设计收起样式
ArgoZhang Nov 15, 2024
ebd8433
feat: Layout 组件支持 static 渲染模式
ArgoZhang Nov 15, 2024
310f64d
fix(Widget): 修复报错问题
ArgoZhang Nov 15, 2024
a4a439a
chore: bump version 9.0.0-beta03
ArgoZhang Nov 15, 2024
4c901b9
Merge branch 'fix-widget' into refactor-layout
ArgoZhang Nov 15, 2024
cdf567b
style: 移除抽屉 padding 间隙
ArgoZhang Nov 15, 2024
98adb63
refactor: 移除宽度计算样式
ArgoZhang Nov 15, 2024
424c97d
doc: 后台示例更新登录信息栏
ArgoZhang Nov 15, 2024
06f032f
doc: 格式化文档
ArgoZhang Nov 15, 2024
46b4499
refactor: 样式独立文件
ArgoZhang Nov 15, 2024
f7109b5
Merge branch 'main' into refactor-layout
ArgoZhang Nov 15, 2024
d6719c8
doc: 精简样式
ArgoZhang Nov 15, 2024
c9a3a6d
refactor: 更新 Widget 组件与模板一致
ArgoZhang Nov 15, 2024
290ccf5
refactor: 修复调整结构组件状态不正确问题
ArgoZhang Nov 15, 2024
2412f82
refactor: 重构方法提高性能
ArgoZhang Nov 15, 2024
3c07329
refactor: 修复布尔值时不触发 OnStateChanged 回调问题
ArgoZhang Nov 15, 2024
01c4384
refactor: 修复布尔值时不触发 OnStateChanged 回调问题
ArgoZhang Nov 15, 2024
05dc08a
test: 增加单元测试
ArgoZhang Nov 15, 2024
72c8a90
Merge branch 'fix-checkbox' into refactor-layout
ArgoZhang Nov 15, 2024
a68e6ba
refactor: 精简代码提高效率
ArgoZhang Nov 15, 2024
919fc45
refactor: 调整右侧边框样式
ArgoZhang Nov 15, 2024
2f7ef09
Merge branch 'main' into refactor-layout
ArgoZhang Nov 15, 2024
ec32c93
chore: bump version 9.0.1-beta01
ArgoZhang Nov 15, 2024
a96561f
doc: 移除 2019 文字
ArgoZhang Nov 15, 2024
986f750
doc: 移除 2019 文字
ArgoZhang Nov 15, 2024
aacadd6
refactor: 更改样式名称
ArgoZhang Nov 15, 2024
3852c08
refactor: 重构侧边栏收起样式
ArgoZhang Nov 16, 2024
e4dd57c
refactor: 更新 Menu 透明样式
ArgoZhang Nov 16, 2024
c7337b3
doc: 更新后台管理样式
ArgoZhang Nov 16, 2024
dbe8936
Merge branch 'main' into refactor-layout
ArgoZhang Nov 16, 2024
3b7dc76
Merge branch 'main' into refactor-layout
ArgoZhang Nov 16, 2024
d2df72b
style: 兼容 Menu 组件
ArgoZhang Nov 16, 2024
2c252d3
style: 增加响应式布局
ArgoZhang Nov 16, 2024
050a9ff
refactor: 重构样式
ArgoZhang Nov 16, 2024
2083634
Merge branch 'main' into refactor-layout
ArgoZhang Nov 16, 2024
6a959a0
wip: 临时移除静态支持
ArgoZhang Nov 16, 2024
6f1dad1
style: 微调样式
ArgoZhang Nov 16, 2024
7e069e3
refactor: 精简样式
ArgoZhang Nov 16, 2024
19c8e73
style: 微调 Menu 样式
ArgoZhang Nov 16, 2024
b5e03d2
refactor: 增加层次
ArgoZhang Nov 16, 2024
66abe04
style: 调整 Title 颜色
ArgoZhang Nov 16, 2024
91246d0
style: 调整收起展开菜单宽度样式
ArgoZhang Nov 16, 2024
f089beb
style: 增加菜单右侧边框线
ArgoZhang Nov 16, 2024
ac01d8b
doc: 调整文档
ArgoZhang Nov 16, 2024
cc20a41
doc: 更新文档链接
ArgoZhang Nov 16, 2024
5ad122b
style: 合并样式
ArgoZhang Nov 16, 2024
c2f351a
style: 合并样式
ArgoZhang Nov 16, 2024
2c56f7b
style: 整理 header-bar 样式
ArgoZhang Nov 16, 2024
4b5ade9
refactor: 重构样式
ArgoZhang Nov 16, 2024
f5fa337
style: 层次化样式
ArgoZhang Nov 16, 2024
81589e1
style: 层次化样式
ArgoZhang Nov 16, 2024
a746d89
refactor: 移除 IsPage 参数
ArgoZhang Nov 16, 2024
5af44e1
refactor: 移除 static 判断逻辑
ArgoZhang Nov 16, 2024
c7b8631
style: 合并 Header 样式
ArgoZhang Nov 16, 2024
8e07f2e
refactor: 移除侧边栏抽屉
ArgoZhang Nov 16, 2024
0755409
style: 合并样式
ArgoZhang Nov 16, 2024
d5f3b8c
refactor: 移除 SideWidth=“0” 设置
ArgoZhang Nov 16, 2024
563ac2f
refactor: 使用 div 元素渲染按钮
ArgoZhang Nov 16, 2024
d46f196
refactor: 恢复脚本
ArgoZhang Nov 16, 2024
a81c413
refactor: 重构代码
ArgoZhang Nov 16, 2024
521351a
doc: 移除 IsPage 文档
ArgoZhang Nov 16, 2024
ecafc3a
doc: 更新开发工具名称
ArgoZhang Nov 16, 2024
c89b9ed
Merge branch 'main' into refactory-layout-style
ArgoZhang Nov 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions src/BootstrapBlazor.Server/Components/Components/Widget.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<DropdownWidget>
<DropdownWidgetItem Icon="fa-regular fa-envelope" BadgeNumber="4" BadgeColor="Color.Primary">
<DropdownWidget class="px-3 d-none d-sm-block">
<DropdownWidgetItem Icon="fa-regular fa-envelope" BadgeNumber="4">
<HeaderTemplate>
<span>您有 4 个未读消息</span>
</HeaderTemplate>
Expand All @@ -8,12 +8,12 @@
{
<a class="dropdown-item d-flex align-items-center" href="#" @onclick:preventDefault>
<div style="width: 40px; height: 40px;">
<Avatar Url="./images/Argo-C.png" IsCircle="true" Size="Size.Small" />
<Avatar Url="images/Argo-C.png" IsCircle="true" Size="Size.Small" />
</div>
<div class="ms-2">
<div class="d-flex position-relative">
<h4>Argo Zhang</h4>
<small><i class="fa-regular fa-clock"></i> @(4 + index) mins</small>
<div class="flex-fill">Argo Zhang</div>
<small><i class="fa fa-clock-o"></i> @(4 + index) mins</small>
</div>
<div class="text-truncate">Why not buy a new awesome theme?</div>
</div>
Expand All @@ -24,15 +24,15 @@
<a href="#" @onclick:preventDefault>查看所有消息</a>
</FooterTemplate>
</DropdownWidgetItem>
<DropdownWidgetItem Icon="fa-regular fa-bell" BadgeNumber="10" HeaderColor="Color.Success" BadgeColor="Color.Success">
<DropdownWidgetItem Icon="fa-regular fa-bell" BadgeNumber="10" HeaderColor="Color.Success" BadgeColor="Color.Warning">
<HeaderTemplate>
<span>您有 10 个未读通知</span>
</HeaderTemplate>
<BodyTemplate>
@for (var index = 0; index < 10; index++)
{
<a class="dropdown-item d-flex align-items-center" href="#" @onclick:preventDefault>
<i class="fa-solid fa-users text-primary"></i>
<i class="fa fa-users text-primary"></i>
<div class="ms-2">5 new members joined</div>
</a>
}
Expand All @@ -41,31 +41,31 @@
<a href="#" @onclick:preventDefault>查看所有通知</a>
</FooterTemplate>
</DropdownWidgetItem>
<DropdownWidgetItem Icon="fa-solid fa-flag" BadgeNumber="9" HeaderColor="Color.Danger" BadgeColor="Color.Danger">
<DropdownWidgetItem Icon="fa-regular fa-flag" BadgeNumber="9" HeaderColor="Color.Danger" BadgeColor="Color.Danger">
<HeaderTemplate>
<span>您有 3 个任务</span>
</HeaderTemplate>
<BodyTemplate>
<a href="#" class="dropdown-item" @onclick:preventDefault>
<h3 class="position-relative">
Design some buttons
<small class="pull-right">20%</small>
</h3>
<BootstrapBlazor.Components.Progress IsAnimated="true" IsStriped="true" Value="20" Color="Color.Primary"></BootstrapBlazor.Components.Progress>
<div class="d-flex">
<div class="flex-fill pe-5">Design some buttons</div>
<small>20%</small>
</div>
<Progress IsAnimated="true" IsStriped="true" Value="20" Color="Color.Primary"></Progress>
</a>
<a href="#" class="dropdown-item" @onclick:preventDefault>
<h3 class="position-relative">
Create a nice theme
<small class="pull-right">40%</small>
</h3>
<BootstrapBlazor.Components.Progress Value="40" Color="Color.Success"></BootstrapBlazor.Components.Progress>
<div class="d-flex">
<div class="flex-fill pe-5">Create a nice theme</div>
<small>40%</small>
</div>
<Progress Value="40" Color="Color.Success"></Progress>
</a>
<a href="#" class="dropdown-item" @onclick:preventDefault>
<h3 class="position-relative">
Some task I need to do
<small class="pull-right">60%</small>
</h3>
<BootstrapBlazor.Components.Progress Value="60" Color="Color.Danger"></BootstrapBlazor.Components.Progress>
<div class="d-flex">
<div class="flex-fill pe-5">Some task I need to do</div>
<small>60%</small>
</div>
<Progress Value="60" Color="Color.Danger"></Progress>
</a>
</BodyTemplate>
<FooterTemplate>
Expand Down
123 changes: 13 additions & 110 deletions src/BootstrapBlazor.Server/Components/Layout/PageLayout.razor
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
@inherits LayoutComponentBase
@inject IOptionsMonitor<WebsiteOptions> WebsiteOption

<HeadContent>
<link href="./css/layout.css" rel="stylesheet" />
</HeadContent>

<CascadingValue Value="this" IsFixed="true">
<Layout SideWidth="0" IsPage="true" IsFullSide="@IsFullSide" IsFixedHeader="@IsFixedHeader" IsFixedFooter="@IsFixedFooter"
<Layout IsFullSide="@IsFullSide" IsFixedHeader="@IsFixedHeader" IsFixedFooter="@IsFixedFooter"
ShowFooter="@ShowFooter" ShowGotoTop="true" ShowCollapseBar="true" Menus="@Menus"
UseTabSet="@UseTabSet" TabDefaultUrl="layout-page" AdditionalAssemblies="new[] { GetType().Assembly }" class="@LayoutClassString">
<Header>
<span class="ms-3 flex-fill">Bootstrap of Blazor</span>
<Widget></Widget>
<img alt="avatar" src="./images/Argo-C.png" class="layout-avatar-right" />
<span class="mx-3 d-none d-sm-block">超级管理员</span>
<div class="layout-drawer" @onclick="@ToggleDrawer"><i class="fa-solid fa-gears"></i></div>
<Logout ImageUrl="images/Argo-C.png" DisplayName="超级管理员" UserName="Admin">
<LinkTemplate>
<a href="#"><i class="fa-solid fa-suitcase"></i>个人中心</a>
<a href="#"><i class="fa-solid fa-cog"></i>设置</a>
<a href="#"><i class="fa-solid fa-bell"></i>通知<span class="badge badge-pill badge-success"></span></a>
<LogoutLink />
</LinkTemplate>
</Logout>
</Header>
<Side>
<div class="layout-banner">
Expand All @@ -29,110 +38,4 @@
</div>
</Footer>
</Layout>

<Drawer Placement="Placement.Right" @bind-IsOpen="@IsOpen" IsBackdrop="true">
<div class="layout-drawer-body">
<div class="btn btn-info w-100" @onclick="@(e => IsOpen = false)">点击关闭</div>
<div class="page-layout-demo-option">
<p>布局调整</p>
<div class="row">
<div class="col-6">
<Tooltip Title="左右结构">
<div class="layout-item @(IsFullSide ? "active d-flex" : "d-flex")" @onclick="@(e => IsFullSide = true)">
<div class="layout-left d-flex flex-column">
<div class="layout-left-header"></div>
<div class="layout-left-body flex-fill"></div>
</div>
<div class="layout-right d-flex flex-column flex-fill">
<div class="layout-right-header"></div>
<div class="layout-right-body flex-fill"></div>
<div class="layout-right-footer"></div>
</div>
</div>
</Tooltip>
</div>
<div class="col-6">
<Tooltip Title="上下结构">
<div class="layout-item flex-column @(IsFullSide ? "d-flex" : "active d-flex")" @onclick="@(e => IsFullSide = false)">
<div class="layout-top">
</div>
<div class="layout-body d-flex flex-fill">
<div class="layout-left">
</div>
<div class="layout-right flex-fill">
</div>
</div>
<div class="layout-footer">
</div>
</div>
</Tooltip>
</div>
</div>
</div>

<div class="page-layout-demo-option">
<p>固定调整</p>
<div class="row">
<div class="col-6 d-flex align-items-center">
<Switch @bind-Value="@IsFixedHeader" OnColor="@Color.Success" OffColor="@Color.Secondary"></Switch>
</div>
<div class="col-6 text-end">
<span>固定页头</span>
</div>
</div>
<div class="row mt-3">
<div class="col-6 d-flex align-items-center">
<Switch @bind-Value="@IsFixedFooter" OnColor="@Color.Success" OffColor="@Color.Secondary"></Switch>
</div>
<div class="col-6 text-end">
<span>固定页脚</span>
</div>
</div>
<div class="row mt-3">
<div class="col-6 d-flex align-items-center">
<Switch @bind-Value="@ShowFooter" OnColor="@Color.Success" OffColor="@Color.Secondary"></Switch>
</div>
<div class="col-6 text-end">
<span>显示页脚</span>
</div>
</div>
</div>

<div class="page-layout-demo-option">
<p>主题配色</p>
<div class="row">
<div class="col-2">
<span class="color color1" @onclick="@(e => Theme = "color1")"></span>
</div>
<div class="col-2">
<span class="color color2" @onclick="@(e => Theme = "color2")"></span>
</div>
<div class="col-2">
<span class="color color3" @onclick="@(e => Theme = "color3")"></span>
</div>
<div class="col-2">
<span class="color color4" @onclick="@(e => Theme = "color4")"></span>
</div>
<div class="col-2">
<span class="color color5" @onclick="@(e => Theme = "color5")"></span>
</div>
<div class="col-2">
<span class="color color6" @onclick="@(e => Theme = "color6")"></span>
</div>
</div>
</div>

<div class="page-layout-demo-option">
<p>更多设置</p>
<div class="row">
<div class="col-6 d-flex align-items-center">
<Switch @bind-Value="@UseTabSet" OnColor="@Color.Success" OffColor="@Color.Primary"></Switch>
</div>
<div class="col-6 text-end">
<span>@(UseTabSet ? "多标签" : "单页")</span>
</div>
</div>
</div>
</div>
</Drawer>
</CascadingValue>
11 changes: 0 additions & 11 deletions src/BootstrapBlazor.Server/Components/Layout/PageLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,31 @@ public sealed partial class PageLayout
/// <summary>
/// 获得/设置 是否固定 TabHeader
/// </summary>
[Parameter]
public bool IsFixedTab { get; set; }

/// <summary>
/// 获得/设置 是否固定页头
/// </summary>
[Parameter]
public bool IsFixedHeader { get; set; } = true;

/// <summary>
/// 获得/设置 是否固定页脚
/// </summary>
[Parameter]
public bool IsFixedFooter { get; set; } = true;

/// <summary>
/// 获得/设置 侧边栏是否外置
/// </summary>
[Parameter]
public bool IsFullSide { get; set; } = true;

/// <summary>
/// 获得/设置 是否显示页脚
/// </summary>
[Parameter]
public bool ShowFooter { get; set; } = true;

/// <summary>
/// 获得/设置 是否开启多标签模式
/// </summary>
[Parameter]
public bool UseTabSet { get; set; } = true;

/// <summary>
Expand All @@ -80,9 +74,4 @@ protected override async Task OnInitializedAsync()
/// 更新组件方法
/// </summary>
public void Update() => StateHasChanged();

private void ToggleDrawer()
{
IsOpen = !IsOpen;
}
}
Loading