Skip to content

Commit 09f8ec1

Browse files
committed
Add BreadcrumbService docs, metadata, and menu entry
- Added BreadcrumbService documentation page and menu entry - Expanded Breadcrumb and BreadcrumbItem with XML docs and metadata attributes ([AddedVersion], [DefaultValue], [Description], [ParameterTypeName]) - Made Breadcrumb.Items nullable and updated its documentation - Introduced MethodNameAttribute for method signature annotation - Updated BreadcrumbService with metadata and [MethodName] usage - Enhanced MethodInfoExtensions and DocxMethodRow to support method name display from attribute - Updated DemoRouteConstants with Docs_URL_BreadcrumbService route - Improved documentation tables for Breadcrumb, BreadcrumbItem, and BreadcrumbService
1 parent 81d68bb commit 09f8ec1

File tree

10 files changed

+131
-5
lines changed

10 files changed

+131
-5
lines changed

BlazorBootstrap.Demo.RCL/Components/Layout/DocsMainLayout.razor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ internal override IEnumerable<NavItem> GetNavItems()
7575
new (){ Id = "605", Text = "Scatter Chart", Href = DemoRouteConstants.Docs_URL_ScatterChart, IconName = IconName.GraphUpArrow, ParentId = "6", Match = NavLinkMatch.All },
7676

7777
new(){ Id = "7", Text = "Services", IconName = IconName.WrenchAdjustableCircleFill, IconColor = IconColor.Success },
78-
new (){ Id = "700", Text = "Modal Service", Href = DemoRouteConstants.Docs_URL_ModalService, IconName = IconName.WindowStack, ParentId = "7" },
78+
new (){ Id = "700", Text = "Breadcrumb Service", Href = DemoRouteConstants.Docs_URL_BreadcrumbService, IconName = IconName.WindowStack, ParentId = "7" },
79+
new (){ Id = "701", Text = "Modal Service", Href = DemoRouteConstants.Docs_URL_ModalService, IconName = IconName.WindowStack, ParentId = "7" },
7980

8081
//new(){ Id = "19", Text = "Utilities", IconName = IconName.GearWideConnected, IconColor = IconColor.Info },
8182
//new (){ Id = "1900", Text = "Color Utility", Href = DemoRouteConstants.Docs_URL_ColorUtils, IconName = IconName.Palette2, ParentId = "19" },

BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Breadcrumb/Breadcrumb_Doc_01_Documentation.razor

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
<DocxTable TItem="Breadcrumb" DocType="DocType.Parameters" />
1919
</Section>
2020

21+
<Section Class="p-0" Size="HeadingSize.H3" Name="BreadcrumbItem Properties" PageUrl="@pageUrl" Link="breadcrumb-item-properties">
22+
<DocxTable TItem="BreadcrumbItem" DocType="DocType.Properties" />
23+
</Section>
24+
25+
<Section Class="p-0" Size="HeadingSize.H3" Name="BreadcrumbService Methods" PageUrl="@pageUrl" Link="breadcrumb-service-methods">
26+
<DocxTable TItem="BreadcrumbService" DocType="DocType.Methods" />
27+
</Section>
28+
2129
@code {
2230
private const string componentName = nameof(Breadcrumb);
2331
private const string pageUrl = DemoRouteConstants.Docs_URL_Breadcrumb;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@attribute [Route(pageUrl)]
2+
@layout DocsMainLayout
3+
4+
<DocsPageHeadSection PageUrl="@pageUrl"
5+
PageTitle="@pageTitle"
6+
PageDescription="@pageDescription"
7+
MetaTitle="@metaTitle"
8+
MetaDescription="@metaDescription"
9+
ImageUrl="@imageUrl" />
10+
11+
<DemoLink Href="@DemoRouteConstants.Demos_URL_ModalService" />
12+
13+
<Section Class="p-0" Size="HeadingSize.H3" Name="Screenshot" PageUrl="@pageUrl" Link="screenshot">
14+
<img src="@imageUrl" class="img-fluid" alt="@metaTitle" />
15+
</Section>
16+
17+
<Section Class="p-0" Size="HeadingSize.H3" Name="BreadcrumbService Methods" PageUrl="@pageUrl" Link="breadcrumb-service-methods">
18+
<DocxTable TItem="BreadcrumbService" DocType="DocType.Methods" />
19+
</Section>
20+
21+
@code {
22+
private const string componentName = nameof(BreadcrumbService);
23+
private const string pageUrl = DemoRouteConstants.Docs_URL_BreadcrumbService;
24+
private const string pageTitle = componentName;
25+
private const string pageDescription = $"This documentation provides a comprehensive reference for the <code>{componentName}</code> component, guiding you through its configuration options.";
26+
private const string metaTitle = $"Blazor {componentName} Component";
27+
private const string metaDescription = $"This documentation provides a comprehensive reference for the {componentName} component, guiding you through its configuration options.";
28+
private const string imageUrl = DemoScreenshotSrcConstants.Demos_URL_Breadcrumb;
29+
}

BlazorBootstrap.Demo.RCL/Components/Shared/DocxTable/DocxMethodRow.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public partial class DocxMethodRow<TItem> : BlazorBootstrapComponentBase
1111

1212
public string ReturnType => MethodInfo.GetMethodReturnTypeName() ?? MethodInfo.GetMethodReturnType();
1313

14-
public string MethodNameWithParameters => $"{MethodInfo.Name}({MethodParameters})";
14+
public string MethodNameWithParameters => MethodInfo.GetMethodName() ?? $"{MethodInfo.Name}({MethodParameters})";
1515

1616
public string MethodParameters => MethodInfo.GetMethodParameters();
1717

BlazorBootstrap.Demo.RCL/Constants/DemoRouteConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ public static class DemoRouteConstants
195195

196196
// Services
197197
public const string Docs_URL_Services_Prefix = Docs_URL_Prefix + "/services";
198+
public const string Docs_URL_BreadcrumbService = Docs_URL_Services_Prefix + "/breadcrumb-service";
198199
public const string Docs_URL_ModalService = Docs_URL_Services_Prefix + "/modal-service";
199200

200201
// Utilities

BlazorBootstrap.Demo.RCL/Extensions/MethodInfoExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ public static string GetMethodDescription(this MethodInfo methodInfo)
3232
return descriptionAttribute?.Description ?? string.Empty;
3333
}
3434

35+
/// <summary>
36+
/// Get method name.
37+
/// </summary>
38+
/// <param name="methodInfo"></param>
39+
/// <returns>string</returns>
40+
public static string GetMethodName(this MethodInfo methodInfo)
41+
{
42+
var methodNameAttribute = methodInfo.GetCustomAttributes(typeof(MethodNameAttribute), false).FirstOrDefault() as MethodNameAttribute;
43+
return methodNameAttribute?.MethodName ?? null!;
44+
}
45+
3546
public static string GetMethodParameters(this MethodInfo methodInfo)
3647
{
3748
var parameters = methodInfo.GetParameters();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace BlazorBootstrap;
2+
3+
/// <summary>
4+
/// Attribute to specify the method name with parameters.
5+
/// </summary>
6+
public class MethodNameAttribute : Attribute
7+
{
8+
#region Constructors
9+
10+
public MethodNameAttribute(string methodName)
11+
{
12+
MethodName = methodName;
13+
}
14+
15+
#endregion
16+
17+
#region Properties, Indexers
18+
19+
public string MethodName { get; }
20+
21+
#endregion
22+
}

blazorbootstrap/Components/Breadcrumb/Breadcrumb.razor.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,21 @@ private void OnNotify(List<BreadcrumbItem> items)
3737

3838
#region Properties, Indexers
3939

40-
[Inject] private BreadcrumbService BreadcrumbService { get; set; } = default!;
40+
[Inject]
41+
private BreadcrumbService BreadcrumbService { get; set; } = default!;
4142

4243
/// <summary>
4344
/// Gets or sets the items.
4445
/// </summary>
4546
/// <remarks>
46-
/// Default value is null.
47+
/// Default value is <see langword="null"/>.
4748
/// </remarks>
49+
[AddedVersion("1.0.0")]
50+
[DefaultValue(null)]
51+
[Description("Gets or sets the items.")]
52+
[ParameterTypeName("List<BreadcrumbItem>?")]
4853
[Parameter]
49-
public List<BreadcrumbItem> Items { get; set; } = default!;
54+
public List<BreadcrumbItem>? Items { get; set; }
5055

5156
#endregion
5257
}

blazorbootstrap/Models/BreadcrumbItem.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,45 @@
11
namespace BlazorBootstrap;
22

3+
/// <summary>
4+
/// Represents a single breadcrumb navigation item.
5+
/// </summary>
36
public class BreadcrumbItem
47
{
58
#region Properties, Indexers
69

10+
/// <summary>
11+
/// Gets or sets the navigation URL for the breadcrumb item.
12+
/// </summary>
13+
/// <remarks>
14+
/// Default value is <see langword="null" />.
15+
/// </remarks>
16+
[AddedVersion("1.0.0")]
17+
[DefaultValue(null)]
18+
[Description("Gets or sets the navigation URL for the breadcrumb item.")]
19+
[ParameterTypeName("string?")]
720
public string? Href { get; set; }
21+
22+
/// <summary>
23+
/// Gets or sets whether this item represents the current page.
24+
/// </summary>
25+
/// <remarks>
26+
/// Default value is <see langword="false"/>.
27+
/// </remarks>
28+
[AddedVersion("1.0.0")]
29+
[DefaultValue(false)]
30+
[Description("Gets or sets whether this item represents the current page.")]
831
public bool IsCurrentPage { get; set; }
32+
33+
/// <summary>
34+
/// Gets or sets the display text for the breadcrumb item.
35+
/// </summary>
36+
/// <remarks>
37+
/// Default value is <see langword="null" />.
38+
/// </remarks>
39+
[AddedVersion("1.0.0")]
40+
[DefaultValue(null)]
41+
[Description("Gets or sets the display text for the breadcrumb item.")]
42+
[ParameterTypeName("string?")]
943
public string? Text { get; set; }
1044

1145
#endregion

blazorbootstrap/Services/BreadcrumbService.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
namespace BlazorBootstrap;
22

3+
/// <summary>
4+
/// Provides a simple publish/subscribe mechanism to update `Breadcrumb` items from anywhere in the application.
5+
/// </summary>
36
public class BreadcrumbService
47
{
58
#region Events
69

10+
/// <summary>
11+
/// Occurs when breadcrumb items are updated via <see cref="Notify(List{BreadcrumbItem})" />.
12+
/// </summary>
13+
[AddedVersion("1.9.2")]
14+
[Description("Occurs when breadcrumb items are updated via Notify(List<BreadcrumbItem>).")]
715
internal event Action<List<BreadcrumbItem>> OnNotify = default!;
816

917
#endregion
1018

1119
#region Methods
1220

21+
/// <summary>
22+
/// Notifies subscribers with the latest breadcrumb items.
23+
/// </summary>
24+
/// <param name="items">The breadcrumb items.</param>
25+
[AddedVersion("1.9.2")]
26+
[Description("Notifies subscribers with the latest breadcrumb items.")]
27+
[MethodName("Notify(List<BreadcrumbItem> items)")]
1328
public void Notify(List<BreadcrumbItem> items) => OnNotify?.Invoke(items);
1429

1530
#endregion

0 commit comments

Comments
 (0)