Skip to content

Commit d0d24b3

Browse files
authored
doc(Icon): update css refer documentation (#4398)
* doc: 更新 BootstrapIcon 文档 * doc: 增加 MD 图标文档 * refactor: 精简代码 * refactor: 精简代码
1 parent 6852311 commit d0d24b3

File tree

6 files changed

+38
-19
lines changed

6 files changed

+38
-19
lines changed

src/BootstrapBlazor.Server/Components/Components/Pre.razor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ private string FindCodeSnippetByName(string code)
180180
return content.TrimEnd('\n');
181181
}
182182

183-
[GeneratedRegex("<section ignore[ \\s\\S]*?>[\\s\\S]*?</section>")]
183+
[GeneratedRegex(@"<section ignore[ \s\S]*?>[\s\S]*?</section>")]
184184
private static partial Regex IgnoreRegex();
185185

186-
[GeneratedRegex("<ConsoleLogger [\\s\\S]* />")]
186+
[GeneratedRegex(@"<ConsoleLogger [\s\S]* />")]
187187
private static partial Regex ConsoleLoggerRegex();
188188

189-
[GeneratedRegex("<Tips[\\s\\S]*>[\\s\\S]*?</Tips>")]
189+
[GeneratedRegex(@"<Tips[\s\S]*>[\s\S]*?</Tips>")]
190190
private static partial Regex TipsRegex();
191191
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@
88

99
<PackageTips Name="BootstrapBlazor.BootstrapIcon" />
1010

11+
<Tips class="mt-3">
12+
<div>@Localizer["P1"] <a href="https://www.nuget.org/packages/BootstrapBlazor.BootstrapIcon/" target="_blank">BootstrapBlazor.BootstrapIcon</a> @Localizer["P2"]</div>
13+
</Tips>
14+
15+
<Pre>&lt;link href="_content/BootstrapBlazor.BootstrapIcon/css/bootstrap.min.css" rel="stylesheet"&gt;</Pre>
16+
1117
<div>@((MarkupString)Localizer["Icons"].Value)</div>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@
88

99
<PackageTips Name="BootstrapBlazor.MaterialDesign" />
1010

11+
<Tips class="mt-3">
12+
<div>@Localizer["P1"] <a href="https://www.nuget.org/packages/BootstrapBlazor.MaterialDesign/" target="_blank">BootstrapBlazor.BootstrapIcon</a> @Localizer["P2"]</div>
13+
</Tips>
14+
15+
<Pre>&lt;link href="_content/BootstrapBlazor.MaterialDesign/css/md.min.css" rel="stylesheet"&gt;</Pre>
16+
1117
<div>@((MarkupString)Localizer["Icons"].Value)</div>

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6647,7 +6647,9 @@
66476647
"BootstrapBlazor.Server.Components.Samples.Icons.BootstrapIcons": {
66486648
"Title": "Bootstrap Icons",
66496649
"BaseUsageText": "Free, high quality, open source icon library",
6650-
"Icons": "For icon information, please visit <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[portal]</a>"
6650+
"Icons": "For icon information, please visit <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[portal]</a>",
6651+
"P1": "Extending the Component Package by Reference",
6652+
"P2": "After adding the stylesheet file link open icon"
66516653
},
66526654
"BootstrapBlazor.Server.Components.Samples.Icons.ElementIcons": {
66536655
"ElementIconTitle": "Element-plus Icons",
@@ -6666,7 +6668,9 @@
66666668
"BootstrapBlazor.Server.Components.Samples.Icons.MaterialDesignIcons": {
66676669
"Title": "MaterialDesign Icons",
66686670
"BaseUsageText": "Material Design system icons are simple, modern and user-friendly",
6669-
"Icons": "For icon information, please visit <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[portal]</a>"
6671+
"Icons": "For icon information, please visit <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[portal]</a>",
6672+
"P1": "Extending the Component Package by Reference",
6673+
"P2": "After adding the stylesheet file link open icon"
66706674
},
66716675
"BootstrapBlazor.Server.Components.Samples.Icons.IconParks": {
66726676
"IconParkTitle": "ByteDance Svg Icon Lib",

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6647,7 +6647,9 @@
66476647
"BootstrapBlazor.Server.Components.Samples.Icons.BootstrapIcons": {
66486648
"Title": "Bootstrap Icons",
66496649
"BaseUsageText": "Bootstrap 免费开源图标库",
6650-
"Icons": "图标信息请通过 <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[传送门]</a> 查看"
6650+
"Icons": "图标信息请通过 <a href=\"https://icons.getbootstrap.com/\" target=\"_blank\">[传送门]</a> 查看",
6651+
"P1": "通过引用扩展组件包",
6652+
"P2": "后添加样式表文件链接开启图标"
66516653
},
66526654
"BootstrapBlazor.Server.Components.Samples.Icons.ElementIcons": {
66536655
"ElementIconTitle": "饿了么图标库",
@@ -6666,7 +6668,9 @@
66666668
"BootstrapBlazor.Server.Components.Samples.Icons.MaterialDesignIcons": {
66676669
"Title": "MaterialDesign Icons",
66686670
"BaseUsageText": "Material Design 图标简单、现代、友好",
6669-
"Icons": "图标信息请通过 <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[传送门]</a> 查看"
6671+
"Icons": "图标信息请通过 <a href=\"https://pictogrammers.com/library/mdi/\" target=\"_blank\">[传送门]</a> 查看",
6672+
"P1": "通过引用扩展组件包",
6673+
"P2": "后添加样式表文件链接开启图标"
66706674
},
66716675
"BootstrapBlazor.Server.Components.Samples.Icons.IconParks": {
66726676
"IconParkTitle": "字节跳动图标库",

src/BootstrapBlazor.Server/Services/PackageVersionService.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace BootstrapBlazor.Server.Services;
66

77
class PackageVersionService
88
{
9-
private IHttpClientFactory Factory { get; set; }
9+
private IHttpClientFactory Factory { get; }
1010

1111
public string? Version { get; }
1212

@@ -16,14 +16,9 @@ class PackageVersionService
1616
public PackageVersionService(IHttpClientFactory factory)
1717
{
1818
Factory = factory;
19-
if (OperatingSystem.IsBrowser())
20-
{
21-
Version = typeof(BootstrapComponentBase).Assembly.GetName().Version?.ToString();
22-
}
23-
else
24-
{
25-
Version = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(BootstrapComponentBase).Assembly.Location).ProductVersion;
26-
}
19+
Version = OperatingSystem.IsBrowser()
20+
? typeof(BootstrapComponentBase).Assembly.GetName().Version?.ToString()
21+
: System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(BootstrapComponentBase).Assembly.Location).ProductVersion;
2722

2823
if (!string.IsNullOrEmpty(Version))
2924
{
@@ -43,7 +38,7 @@ public PackageVersionService(IHttpClientFactory factory)
4338

4439
private async Task<string> FetchVersionAsync(string packageName = "bootstrapblazor")
4540
{
46-
var version = "lastest";
41+
var version = "latest";
4742
try
4843
{
4944
var url = $"https://azuresearch-usnc.nuget.org/query?q={packageName}&prerelease=true&semVerLevel=2.0.0";
@@ -55,7 +50,11 @@ private async Task<string> FetchVersionAsync(string packageName = "bootstrapblaz
5550
version = package.GetVersion();
5651
}
5752
}
58-
catch { }
53+
catch
54+
{
55+
// ignored
56+
}
57+
5958
return version;
6059
}
6160

@@ -67,7 +66,7 @@ private class NugetPackage
6766
public IEnumerable<NugetPackageData> Data { get; set; } = Array.Empty<NugetPackageData>();
6867

6968
/// <summary>
70-
///
69+
///
7170
/// </summary>
7271
/// <returns></returns>
7372
public string GetVersion() => Data.FirstOrDefault()?.Version ?? "";

0 commit comments

Comments
 (0)