Skip to content

Commit 28f82b8

Browse files
authored
Enhance Toasts docs and add API metadata attributes (#1230)
Improved XML documentation and added [AddedVersion], [DefaultValue], and [Description] attributes to Toasts components, enums, and related classes. Updated documentation pages to include enum details. These changes improve API discoverability and support for documentation tooling.
1 parent f52ed89 commit 28f82b8

File tree

8 files changed

+194
-60
lines changed

8 files changed

+194
-60
lines changed

BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Toasts/Toasts_Doc_01_Documentation.razor

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

21+
<Section Class="p-0" Size="HeadingSize.H3" Name="ToastsPlacement Enum" PageUrl="@pageUrl" Link="toasts-placement-enum">
22+
<DocxTable TItem="ToastsPlacement" DocType="DocType.Enum" />
23+
</Section>
24+
2125
<Section Class="p-0" Size="HeadingSize.H3" Name="ToastMessage Properties" PageUrl="@pageUrl" Link="toast-message-properties">
2226
<DocxTable TItem="ToastMessage" DocType="DocType.Properties" />
2327
</Section>
2428

29+
<Section Class="p-0" Size="HeadingSize.H3" Name="ToastType Enum" PageUrl="@pageUrl" Link="toast-type-enum">
30+
<DocxTable TItem="ToastType" DocType="DocType.Enum" />
31+
</Section>
32+
2533
@code {
2634
private const string componentName = nameof(Toasts);
2735
private const string pageUrl = DemoRouteConstants.Docs_URL_Toasts;

blazorbootstrap/Components/ThemeSwitcher/ThemeSwitcher.razor.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,25 @@ public async Task OnThemeChangedJS(string themeName)
5353
/// <summary>
5454
/// Fired when the theme is changed.
5555
/// </summary>
56+
[AddedVersion("3.2.0")]
57+
[Description("Fired when the theme is changed.")]
5658
[Parameter]
5759
public EventCallback<string> OnThemeChanged { get; set; }
5860

5961
/// <summary>
6062
/// Gets or sets the dropdown menu position.
61-
/// </summary>
62-
/// <remarks>
63+
/// <para>
6364
/// Default value is <see cref="DropdownMenuPosition.Start" />.
64-
/// </remarks>
65+
/// </para>
66+
/// </summary>
67+
[AddedVersion("3.2.0")]
68+
[DefaultValue(DropdownMenuPosition.Start)]
69+
[Description("Gets or sets the dropdown menu position.")]
6570
[Parameter]
6671
public DropdownMenuPosition Position { get; set; } = DropdownMenuPosition.Start;
6772

68-
[Inject] private ThemeSwitcherJsInterop ThemeSwitcherJsInterop { get; set; } = default!;
73+
[Inject]
74+
private ThemeSwitcherJsInterop ThemeSwitcherJsInterop { get; set; } = default!;
6975

7076
#endregion
7177
}

blazorbootstrap/Components/Toasts/SimpleToast.razor.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ protected override async Task OnInitializedAsync()
7171

7272
/// <summary>
7373
/// Gets or sets the auto hide state.
74+
/// <para>
75+
/// Default value is <see langword="true"/>.
76+
/// </para>
7477
/// </summary>
75-
/// <remarks>
76-
/// Default value is true.
77-
/// </remarks>
7878
[Parameter]
7979
public bool AutoHide { get; set; } = true;
8080

8181
private string CloseButtonClass => $"btn-close-{ToastMessage!.Type.ToToastTextColorClass()}";
8282

8383
/// <summary>
8484
/// Gets or sets the delay in milliseconds before hiding the toast.
85-
/// </summary>
86-
/// <remarks>
85+
/// <para>
8786
/// Default value is 5000.
88-
/// </remarks>
87+
/// </para>
88+
/// </summary>
8989
[Parameter]
9090
public int Delay { get; set; } = 5000;
9191

@@ -103,10 +103,10 @@ protected override async Task OnInitializedAsync()
103103

104104
/// <summary>
105105
/// If <see langword="true" />, shows the close button.
106+
/// <para>
107+
/// Default value is <see langword="true"/>.
108+
/// </para>
106109
/// </summary>
107-
/// <remarks>
108-
/// Default value is true.
109-
/// </remarks>
110110
[Parameter]
111111
public bool ShowCloseButton { get; set; } = true;
112112

@@ -124,10 +124,10 @@ protected override async Task OnInitializedAsync()
124124

125125
/// <summary>
126126
/// Gets or sets the toast message.
127+
/// <para>
128+
/// Default value is <see langword="null"/>.
129+
/// </para>
127130
/// </summary>
128-
/// <remarks>
129-
/// Default value is null.
130-
/// </remarks>
131131
[Parameter]
132132
public ToastMessage? ToastMessage { get; set; }
133133

blazorbootstrap/Components/Toasts/Toast.razor.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,19 @@ private IconName GetToastIconName() =>
153153

154154
/// <summary>
155155
/// Gets or sets the auto hide state.
156+
/// <para>
157+
/// Default value is <see langword="false"/>.
158+
/// </para>
156159
/// </summary>
157-
/// <remarks>
158-
/// Default value is false.
159-
/// </remarks>
160160
[Parameter]
161161
public bool AutoHide { get; set; }
162162

163163
/// <summary>
164164
/// Gets or sets the delay in milliseconds before hiding the toast.
165-
/// </summary>
166-
/// <remarks>
165+
/// <para>
167166
/// Default value is 5000.
168-
/// </remarks>
167+
/// </para>
168+
/// </summary>
169169
[Parameter]
170170
public int Delay { get; set; } = 5000;
171171

@@ -189,10 +189,10 @@ private IconName GetToastIconName() =>
189189

190190
/// <summary>
191191
/// If <see langword="true" />, shows the close button.
192+
/// <para>
193+
/// Default value is <see langword="true"/>.
194+
/// </para>
192195
/// </summary>
193-
/// <remarks>
194-
/// Default value is true.
195-
/// </remarks>
196196
[Parameter]
197197
public bool ShowCloseButton { get; set; } = true;
198198

@@ -210,10 +210,10 @@ private IconName GetToastIconName() =>
210210

211211
/// <summary>
212212
/// Gets or sets the toast message.
213+
/// <para>
214+
/// Default value is <see langword="null"/>.
215+
/// </para>
213216
/// </summary>
214-
/// <remarks>
215-
/// Default value is null.
216-
/// </remarks>
217217
[Parameter]
218218
public ToastMessage ToastMessage { get; set; } = default!;
219219

blazorbootstrap/Components/Toasts/Toasts.razor.cs

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,59 +90,78 @@ private async Task OnToastShownAsync(ToastEventArgs args)
9090

9191
/// <summary>
9292
/// Gets or sets the auto hide state.
93+
/// <para>
94+
/// Default value is <see langword="false"/>.
95+
/// </para>
9396
/// </summary>
94-
/// <remarks>
95-
/// Default value is false.
96-
/// </remarks>
97+
[AddedVersion("1.0.0")]
98+
[DefaultValue(false)]
99+
[Description("Gets or sets the auto hide state.")]
97100
[Parameter]
98101
public bool AutoHide { get; set; }
99102

100103
/// <summary>
101104
/// Gets or sets the delay in milliseconds before hiding the toast.
102-
/// </summary>
103-
/// <remarks>
105+
/// <para>
104106
/// Default value is 5000.
105-
/// </remarks>
107+
/// </para>
108+
/// </summary>
109+
[AddedVersion("1.0.0")]
110+
[DefaultValue(5000)]
111+
[Description("Gets or sets the delay in milliseconds before hiding the toast.")]
106112
[Parameter]
107113
public int Delay { get; set; } = 5000;
108114

109115
/// <summary>
110116
/// Gets or sets the toast messages.
117+
/// <para>
118+
/// Default value is <see langword="null"/>.
119+
/// </para>
111120
/// </summary>
112-
/// <remarks>
113-
/// Default value is null.
114-
/// </remarks>
121+
[AddedVersion("1.0.0")]
122+
[DefaultValue(null)]
123+
[Description("Gets or sets the toast messages.")]
115124
[Parameter]
116-
public List<ToastMessage>? Messages { get; set; } = default!;
125+
public List<ToastMessage>? Messages { get; set; }
117126

118127
/// <summary>
119128
/// Gets or sets the toast placement.
120-
/// </summary>
121-
/// <remarks>
129+
/// <para>
122130
/// Default value is <see cref="ToastsPlacement.TopRight" />.
123-
/// </remarks>
131+
/// </para>
132+
/// </summary>
133+
[AddedVersion("1.0.0")]
134+
[DefaultValue(ToastsPlacement.TopRight)]
135+
[Description("Gets or sets the toast placement.")]
124136
[Parameter]
125137
public ToastsPlacement Placement { get; set; } = ToastsPlacement.TopRight;
126138

127139
/// <summary>
128140
/// If <see langword="true" />, shows the close button.
141+
/// <para>
142+
/// Default value is <see langword="true"/>.
143+
/// </para>
129144
/// </summary>
130-
/// <remarks>
131-
/// Default value is true.
132-
/// </remarks>
145+
[AddedVersion("1.0.0")]
146+
[DefaultValue(true)]
147+
[Description("If <b>true</b>, shows the close button.")]
133148
[Parameter]
134149
public bool ShowCloseButton { get; set; } = true;
135150

136151
/// <summary>
137152
/// Gets or sets the toast container maximum capacity.
138-
/// </summary>
139-
/// <remarks>
153+
/// <para>
140154
/// Default value is 5.
141-
/// </remarks>
155+
/// </para>
156+
/// </summary>
157+
[AddedVersion("1.0.0")]
158+
[DefaultValue(5)]
159+
[Description("Gets or sets the toast container maximum capacity.")]
142160
[Parameter]
143161
public int StackLength { get; set; } = 5;
144162

145-
[Inject] public ToastService ToastService { get; set; } = default!;
163+
[Inject]
164+
public ToastService ToastService { get; set; } = default!;
146165

147166
#endregion
148167
}

blazorbootstrap/Enums/ToastType.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,59 @@
33
public enum ToastType
44
{
55
/// <summary>
6-
/// Primary background color.
6+
/// Sets the primary background color to the toast.
77
/// </summary>
8+
[AddedVersion("1.0.0")]
9+
[Description("Sets the primary background color to the toast.")]
810
Primary = 1,
911

1012
/// <summary>
11-
/// Secondary background color.
13+
/// Sets the secondary background color to the toast.
1214
/// </summary>
15+
[AddedVersion("1.0.0")]
16+
[Description("Sets the secondary background color to the toast.")]
1317
Secondary,
1418

1519
/// <summary>
16-
/// Success background color.
20+
/// Sets the success background color to the toast.
1721
/// </summary>
22+
[AddedVersion("1.0.0")]
23+
[Description("Sets the success background color to the toast.")]
1824
Success,
1925

2026
/// <summary>
21-
/// Danger background color.
27+
/// Sets the danger background color to the toast.
2228
/// </summary>
29+
[AddedVersion("1.0.0")]
30+
[Description("Sets the danger background color to the toast.")]
2331
Danger,
2432

2533
/// <summary>
26-
/// Warning background color.
34+
/// Sets the warning background color to the toast.
2735
/// </summary>
36+
[AddedVersion("1.0.0")]
37+
[Description("Sets the warning background color to the toast.")]
2838
Warning,
2939

3040
/// <summary>
31-
/// Info background color.
41+
/// Sets the info background color to the toast.
3242
/// </summary>
43+
[AddedVersion("1.0.0")]
44+
[Description("Sets the info background color to the toast.")]
3345
Info,
3446

3547
/// <summary>
36-
/// Light background color.
48+
/// Sets the light background color to the toast.
3749
/// </summary>
50+
[AddedVersion("1.0.0")]
51+
[Description("Sets the light background color to the toast.")]
3852
Light,
3953

4054
/// <summary>
41-
/// Dark background color.
55+
/// Sets the dark background color to the toast.
4256
/// </summary>
57+
[AddedVersion("1.0.0")]
58+
[Description("Sets the dark background color to the toast.")]
4359
Dark
4460

4561
// TODO: Review

blazorbootstrap/Enums/ToastsPlacement.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,56 @@ public enum ToastsPlacement
77
/// <summary>
88
/// Top center
99
/// </summary>
10+
[AddedVersion("1.0.0")]
11+
[Description("Top center")]
1012
TopCenter,
1113

1214
/// <summary>
1315
/// Top right
1416
/// </summary>
17+
[AddedVersion("1.0.0")]
18+
[Description("Top right")]
1519
TopRight,
1620

1721
/// <summary>
1822
/// Middle left
1923
/// </summary>
24+
[AddedVersion("1.0.0")]
25+
[Description("Middle left")]
2026
MiddleLeft,
2127

2228
/// <summary>
2329
/// Middle center
2430
/// </summary>
31+
[AddedVersion("1.0.0")]
32+
[Description("Middle center")]
2533
MiddleCenter,
2634

2735
/// <summary>
2836
/// Middle right
2937
/// </summary>
38+
[AddedVersion("1.0.0")]
39+
[Description("Middle right")]
3040
MiddleRight,
3141

3242
/// <summary>
3343
/// Bottom left
3444
/// </summary>
45+
[AddedVersion("1.0.0")]
46+
[Description("Bottom left")]
3547
BottomLeft,
3648

3749
/// <summary>
3850
/// Bottom center
3951
/// </summary>
52+
[AddedVersion("1.0.0")]
53+
[Description("Bottom center")]
4054
BottomCenter,
4155

4256
/// <summary>
4357
/// Bottom right
4458
/// </summary>
59+
[AddedVersion("1.0.0")]
60+
[Description("Bottom right")]
4561
BottomRight
4662
}

0 commit comments

Comments
 (0)