Skip to content

Commit 96128dd

Browse files
authored
Add Toast Service docs, nav links, and API annotations (#1231)
- Added "Toast Service" to Demos and Docs navigation menus with new route constants. - Created ToastService documentation page with method/property/enum sections. - Enhanced Tooltip component parameter docs with attributes and improved XML comments; made ChildContent and Title nullable. - Updated Tooltips docs: renamed "Parameters" section and added enum sections. - Documented ToastService.Notify and ToastsPlacement enum with version and description attributes.
1 parent 28f82b8 commit 96128dd

8 files changed

Lines changed: 96 additions & 19 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ internal override IEnumerable<NavItem> GetNavItems()
102102
new (){ Id = "700", Text = "Breadcrumb Service", Href = DemoRouteConstants.Demos_URL_BreadcrumbService, IconName = IconName.SegmentedNav, ParentId = "7" },
103103
new (){ Id = "701", Text = "Modal Service", Href = DemoRouteConstants.Demos_URL_ModalService, IconName = IconName.WindowStack, ParentId = "7" },
104104
new (){ Id = "702", Text = "Preload Service", Href = DemoRouteConstants.Demos_URL_PreloadService, IconName = IconName.ArrowRepeat, ParentId = "7" },
105+
new (){ Id = "703", Text = "Toast Service", Href = DemoRouteConstants.Demos_URL_ToastService, IconName = IconName.InfoCircleFill, ParentId = "7" },
105106

106107
new(){ Id = "19", Text = "Utilities", IconName = IconName.GearWideConnected, IconColor = IconColor.Info },
107108
new (){ Id = "1900", Text = "Color Utility", Href = DemoRouteConstants.Demos_URL_ColorUtils, IconName = IconName.Palette2, ParentId = "19" },

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ internal override IEnumerable<NavItem> GetNavItems()
7878
new (){ Id = "700", Text = "Breadcrumb Service", Href = DemoRouteConstants.Docs_URL_BreadcrumbService, IconName = IconName.SegmentedNav, ParentId = "7" },
7979
new (){ Id = "701", Text = "Modal Service", Href = DemoRouteConstants.Docs_URL_ModalService, IconName = IconName.WindowStack, ParentId = "7" },
8080
new (){ Id = "702", Text = "Preload Service", Href = DemoRouteConstants.Docs_URL_PreloadService, IconName = IconName.ArrowRepeat, ParentId = "7" },
81+
new (){ Id = "703", Text = "Toast Service", Href = DemoRouteConstants.Docs_URL_ToastService, IconName = IconName.InfoCircleFill, ParentId = "7" },
8182

8283
//new(){ Id = "19", Text = "Utilities", IconName = IconName.GearWideConnected, IconColor = IconColor.Info },
8384
//new (){ Id = "1900", Text = "Color Utility", Href = DemoRouteConstants.Docs_URL_ColorUtils, IconName = IconName.Palette2, ParentId = "19" },
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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_PreloadService" />
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="ToastService Methods" PageUrl="@pageUrl" Link="toast-service-methods">
18+
<DocxTable TItem="ToastService" DocType="DocType.Methods" />
19+
</Section>
20+
21+
<Section Class="p-0" Size="HeadingSize.H3" Name="ToastMessage Properties" PageUrl="@pageUrl" Link="toast-message-properties">
22+
<DocxTable TItem="ToastMessage" DocType="DocType.Properties" />
23+
</Section>
24+
25+
<Section Class="p-0" Size="HeadingSize.H3" Name="ToastType Enum" PageUrl="@pageUrl" Link="toast-type-enum">
26+
<DocxTable TItem="ToastType" DocType="DocType.Enum" />
27+
</Section>
28+
29+
@code {
30+
private const string componentName = nameof(ToastService);
31+
private const string pageUrl = DemoRouteConstants.Docs_URL_ToastService;
32+
private const string pageTitle = componentName;
33+
private const string pageDescription = $"This documentation provides a comprehensive reference for the <code>{componentName}</code> component, guiding you through its configuration options.";
34+
private const string metaTitle = $"Blazor {componentName} Component";
35+
private const string metaDescription = $"This documentation provides a comprehensive reference for the {componentName} component, guiding you through its configuration options.";
36+
private const string imageUrl = DemoScreenshotSrcConstants.Demos_URL_Toasts;
37+
}

BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Tooltips/Tooltips_Doc_01_Documentation.razor

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@
1414
<img src="@imageUrl" class="img-fluid" alt="@metaTitle" />
1515
</Section>
1616

17-
<Section Class="p-0" Size="HeadingSize.H3" Name="Parameters" PageUrl="@pageUrl" Link="parameters">
17+
<Section Class="p-0" Size="HeadingSize.H3" Name="Tooltip Parameters" PageUrl="@pageUrl" Link="tooltip-parameters">
1818
<DocxTable TItem="Tooltip" DocType="DocType.Parameters" />
1919
</Section>
2020

21+
<Section Class="p-0" Size="HeadingSize.H3" Name="TooltipColor Enum" PageUrl="@pageUrl" Link="tooltip-color-enum">
22+
<DocxTable TItem="TooltipColor" DocType="DocType.Enum" />
23+
</Section>
24+
25+
<Section Class="p-0" Size="HeadingSize.H3" Name="TooltipPlacement Enum" PageUrl="@pageUrl" Link="tooltip-placement-enum">
26+
<DocxTable TItem="TooltipPlacement" DocType="DocType.Enum" />
27+
</Section>
28+
2129
@code {
2230
private const string componentName = nameof(Tooltip);
2331
private const string pageUrl = DemoRouteConstants.Docs_URL_Tooltips;

BlazorBootstrap.Demo.RCL/Constants/DemoRouteConstants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public static class DemoRouteConstants
111111
public const string Demos_URL_BreadcrumbService = Demos_URL_Services_Prefix + "/breadcrumb-service";
112112
public const string Demos_URL_ModalService = Demos_URL_Services_Prefix + "/modal-service";
113113
public const string Demos_URL_PreloadService = Demos_URL_Services_Prefix + "/preload-service";
114+
public const string Demos_URL_ToastService = Demos_URL_Services_Prefix + "/toast-service";
114115

115116
// Utilities
116117
public const string Demos_URL_Utils_Prefix = Demos_URL_Prefix + "/utils";
@@ -200,6 +201,7 @@ public static class DemoRouteConstants
200201
public const string Docs_URL_BreadcrumbService = Docs_URL_Services_Prefix + "/breadcrumb-service";
201202
public const string Docs_URL_ModalService = Docs_URL_Services_Prefix + "/modal-service";
202203
public const string Docs_URL_PreloadService = Docs_URL_Services_Prefix + "/preload-service";
204+
public const string Docs_URL_ToastService = Docs_URL_Services_Prefix + "/toast-service";
203205

204206
// Utilities
205207
public const string Docs_URL_Utils_Prefix = Docs_URL_Prefix + "/utils";

blazorbootstrap/Components/Tooltip/Tooltip.razor.cs

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,53 +81,68 @@ public async Task ShowAsync()
8181

8282
/// <summary>
8383
/// Gets or sets the content to be rendered within the component.
84+
/// <para>
85+
/// Default value is <see langword="null"/>.
86+
/// </para>
8487
/// </summary>
85-
/// <remarks>
86-
/// Default value is null.
87-
/// </remarks>
88+
[AddedVersion("1.0.0")]
89+
[DefaultValue(null)]
90+
[Description("Gets or sets the content to be rendered within the component.")]
8891
[Parameter]
89-
public RenderFragment ChildContent { get; set; } = default!;
92+
public RenderFragment? ChildContent { get; set; }
9093

9194
/// <summary>
9295
/// Gets or sets the tooltip color.
93-
/// </summary>
94-
/// <remarks>
96+
/// <para>
9597
/// Default value is <see cref="TooltipColor.None" />.
96-
/// </remarks>
98+
/// </para>
99+
/// </summary>
100+
[AddedVersion("1.10.0")]
101+
[DefaultValue(TooltipColor.None)]
102+
[Description("Gets or sets the tooltip color.")]
97103
[Parameter]
98104
public TooltipColor Color { get; set; } = TooltipColor.None;
99105

100106
private string colorClass => Color.ToTooltipColorClass()!;
101107

102108
/// <summary>
103109
/// Gets or sets a value indicating whether to display the content as HTML instead of text.
110+
/// <para>
111+
/// Default value is <see langword="false"/>.
112+
/// </para>
104113
/// </summary>
105-
/// <remarks>
106-
/// Default value is false.
107-
/// </remarks>
114+
[AddedVersion("2.1.0")]
115+
[DefaultValue(false)]
116+
[Description("Gets or sets a value indicating whether to display the content as HTML instead of text.")]
108117
[Parameter]
109118
public bool IsHtml { get; set; }
110119

111120
private string placement => Placement.ToTooltipPlacementName();
112121

113122
/// <summary>
114123
/// Gets or sets the tooltip placement.
115-
/// </summary>
116-
/// <remarks>
124+
/// <para>
117125
/// Default value is <see cref="TooltipPlacement.Top" />.
118-
/// </remarks>
126+
/// </para>
127+
/// </summary>
128+
[AddedVersion("1.0.0")]
129+
[DefaultValue(TooltipPlacement.Top)]
130+
[Description("Gets or sets the tooltip placement.")]
119131
[Parameter]
120132
public TooltipPlacement Placement { get; set; } = TooltipPlacement.Top;
121133

122134
/// <summary>
123135
/// Displays informative text when users hover, focus, or tap an element.
136+
/// <para>
137+
/// Default value is <see langword="null"/>.
138+
/// </para>
124139
/// </summary>
125-
/// <remarks>
126-
/// Default value is null.
127-
/// </remarks>
128-
[Parameter]
140+
[AddedVersion("1.0.0")]
141+
[DefaultValue(null)]
142+
[Description("Displays informative text when users hover, focus, or tap an element.")]
129143
[EditorRequired]
130-
public string Title { get; set; } = default!;
144+
[Parameter]
145+
public string? Title { get; set; }
131146

132147
#endregion
133148
}

blazorbootstrap/Enums/ToastsPlacement.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
public enum ToastsPlacement
44
{
5+
/// <summary>
6+
/// Top left
7+
/// </summary>
8+
[AddedVersion("1.0.0")]
9+
[Description("Top left")]
510
TopLeft,
611

712
/// <summary>

blazorbootstrap/Services/ToastService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ public class ToastService
1010

1111
#region Methods
1212

13+
/// <summary>
14+
/// Notifies subscribers of a new toast message event.
15+
/// </summary>
16+
/// <remarks>If no subscribers are registered, this method has no effect. This method is typically used to
17+
/// display transient notifications to users.</remarks>
18+
/// <param name="toastMessage">The toast message to be delivered to all registered listeners. Cannot be null.</param>
19+
[AddedVersion("1.0.0")]
20+
[Description("Notifies subscribers of a new toast message event.")]
1321
public void Notify(ToastMessage toastMessage) => OnNotify?.Invoke(toastMessage);
1422

1523
#endregion

0 commit comments

Comments
 (0)