Skip to content

Commit 6d8ca20

Browse files
authored
feat(UniverIcon): add UniverIcon component (#5557)
* doc: 增加 UniverIcon 组件 * doc: 更新本地化资源文件 * chore: 增加 UniverIcon 依赖包 * doc: 增加 UniverIcon 菜单 * doc: 增加菜单多语言支持 * chore: 更新包 * refactor: 微调样式 * refactor: 增加 IconLayout 母版页 * doc: 更新样式表路径 * test: 更新单元测试
1 parent dbe0b7e commit 6d8ca20

File tree

12 files changed

+543
-0
lines changed

12 files changed

+543
-0
lines changed

src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<PackageReference Include="BootstrapBlazor.SummerNote" Version="9.0.3" />
6565
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.2.1" />
6666
<PackageReference Include="BootstrapBlazor.Topology" Version="9.0.0" />
67+
<PackageReference Include="BootstrapBlazor.UniverIcon" Version="9.0.1" />
6768
<PackageReference Include="BootstrapBlazor.UniverSheet" Version="9.0.0-beta05" />
6869
<PackageReference Include="BootstrapBlazor.VideoPlayer" Version="9.0.3" />
6970
<PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.7" />
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@inherits LayoutComponentBase
2+
@layout MainLayout
3+
4+
@Body
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the Apache 2.0 License
3+
// See the LICENSE file in the project root for more information.
4+
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
5+
6+
namespace BootstrapBlazor.Server.Components.Layout;
7+
8+
/// <summary>
9+
/// Icon Layout Component
10+
/// </summary>
11+
public partial class IconLayout
12+
{
13+
14+
}

src/BootstrapBlazor.Server/Components/Samples/Icons/UniverIconList.razor

Lines changed: 434 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@page "/univer-icon"
2+
@layout MainLayout
3+
@inject IStringLocalizer<UniverIcons> Localizer
4+
5+
<h3>@Localizer["UniverIconTitle"]</h3>
6+
7+
<h4>@Localizer["UniverIconDescription"]</h4>
8+
9+
<PackageTips Name="BootstrapBlazor.UniverIcon" />
10+
11+
<Tips class="mt-3">
12+
<ul class="ul-demo">
13+
<li>@Localizer["P1"]</li>
14+
<li>@Localizer["P2"]</li>
15+
</ul>
16+
<div>@Localizer["P3"]</div>
17+
</Tips>
18+
19+
<Pre>&lt;link href="_content/BootstrapBlazor.UniverIcon/BootstrapBlazor.UniverIcon.bundle.scp.css" rel="stylesheet"&gt;</Pre>
20+
21+
<Pre>&lt;UniverIcon Name="create-copy-single"&gt;&lt;/UniverIcon&gt;</Pre>
22+
23+
<div>@((MarkupString)Localizer["Icons"].Value)</div>
24+
25+
<div class="icon-list">
26+
<UniverIconList></UniverIconList>
27+
</div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the Apache 2.0 License
3+
// See the LICENSE file in the project root for more information.
4+
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
5+
6+
namespace BootstrapBlazor.Server.Components.Samples.Icons;
7+
8+
/// <summary>
9+
/// OctIcons 图标示例
10+
/// </summary>
11+
public partial class UniverIcons
12+
{
13+
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@layout IconLayout

src/BootstrapBlazor.Server/Extensions/MenusLocalizerExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,12 @@ void AddIcons(DemoMenuItem item)
15831583
{
15841584
Text = Localizer["OctIcon"],
15851585
Url = "oct-icon"
1586+
},
1587+
new()
1588+
{
1589+
IsNew = true,
1590+
Text = Localizer["UniverIcon"],
1591+
Url = "univer-icon"
15861592
}
15871593
};
15881594
AddBadge(item);

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4856,6 +4856,7 @@
48564856
"Affix": "Affix",
48574857
"Watermark": "Watermark",
48584858
"OctIcon": "Oct Icons",
4859+
"UniverIcons": "Univer Icons",
48594860
"Typed": "Typed",
48604861
"UniverSheet": "UniverSheet"
48614862
},
@@ -6781,6 +6782,15 @@
67816782
"P3": "Please copy the following code segement",
67826783
"Icons": "For icon list, please visit <a href=\"https://primer.style/foundations/icons\" target=\"_blank\">[portal]</a>"
67836784
},
6785+
"BootstrapBlazor.Server.Components.Samples.Icons.UniverIcons": {
6786+
"UniverIconTitle": "Univer Svg Icon Lib",
6787+
"UniverIconDescription": "Icons used by Univer",
6788+
"CopiedTooltipText": "Copied",
6789+
"P1": "1. After referencing the extension package, add the package built-in style file to open the icon",
6790+
"P2": "2. Enable css isolation and automatically reference component styles after compilation",
6791+
"P3": "Please copy the following code segement",
6792+
"Icons": "For icon list, please visit <a href=\"https://univer.ai/en-US/icons\" target=\"_blank\">[portal]</a>"
6793+
},
67846794
"BootstrapBlazor.Server.Components.Samples.BootstrapBlazorIcons": {
67856795
"IconsTitle": "Icon",
67866796
"IconsDescription": "Supports font icons, vector SVG icons, and Image pictures",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4856,6 +4856,7 @@
48564856
"Affix": "固钉组件 Affix",
48574857
"Watermark": "水印组件 Watermark",
48584858
"OctIcon": "Oct Icons",
4859+
"UniverIcon": "Univer Icons",
48594860
"Typed": "打字机效果 Typed",
48604861
"UniverSheet": "表格组件 UniverSheet"
48614862
},
@@ -6781,6 +6782,15 @@
67816782
"P3": "请拷贝下方样式即可",
67826783
"Icons": "图标列表请通过 <a href=\"https://primer.style/foundations/icons\" target=\"_blank\">[传送门]</a> 查看"
67836784
},
6785+
"BootstrapBlazor.Server.Components.Samples.Icons.UniverIcons": {
6786+
"UniverIconTitle": "Univer Icon 图标库",
6787+
"UniverIconDescription": "Icons used by Univer",
6788+
"CopiedTooltipText": "拷贝成功",
6789+
"P1": "1. 引用扩展组件包后添加包内置样式文件开启图标",
6790+
"P2": "2. 开启样式隔离,编译后自动引用组件样式",
6791+
"P3": "请拷贝下方样式即可",
6792+
"Icons": "图标列表请通过 <a href=\"https://univer.ai/en-US/icons\" target=\"_blank\">[传送门]</a> 查看"
6793+
},
67846794
"BootstrapBlazor.Server.Components.Samples.BootstrapBlazorIcons": {
67856795
"IconsTitle": "Icon 图标",
67866796
"IconsDescription": "同时支持字体图标、矢量 Svg 图标、以及 Image 图片",

0 commit comments

Comments
 (0)