Skip to content

Commit 2d617c0

Browse files
authored
Enhance Sidebar2 API docs and add metadata attributes (#1226)
Improved XML comments with cref references and HTML formatting for clarity. Added [AddedVersion], [DefaultValue], and [Description] attributes to public properties and methods. Removed redundant remarks and [EditorRequired] from DataProvider. These changes make the Sidebar2 API more self-describing and tooling-friendly.
1 parent 440780b commit 2d617c0

File tree

1 file changed

+71
-31
lines changed

1 file changed

+71
-31
lines changed

blazorbootstrap/Components/Sidebar2/Sidebar2.razor.cs

Lines changed: 71 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ public void bsWindowResize(int width)
5555
}
5656

5757
/// <summary>
58-
/// Refresh the sidebar data.
58+
/// Refresh the <see cref="Sidebar2"/> data.
5959
/// </summary>
6060
/// <returns>Task</returns>
61+
[AddedVersion("2.1.0")]
62+
[Description("Refresh the <b>Sidebar2</b> data.")]
6163
public async Task RefreshDataAsync(bool firstRender = false)
6264
{
6365
if (requestInProgress)
@@ -79,8 +81,10 @@ public async Task RefreshDataAsync(bool firstRender = false)
7981
}
8082

8183
/// <summary>
82-
/// Toggles sidebar.
84+
/// Toggles <see cref="Sidebar2"/>.
8385
/// </summary>
86+
[AddedVersion("2.1.0")]
87+
[Description("Toggles <b>Sidebar2</b>.")]
8488
public void ToggleSidebar()
8589
{
8690
collapseSidebar = !collapseSidebar;
@@ -130,88 +134,124 @@ private string GetNavMenuCssClass()
130134
/// <summary>
131135
/// Gets or sets the badge text.
132136
/// </summary>
133-
/// <remarks>
134-
/// Default value is null.
135-
/// </remarks>
137+
/// <para>
138+
/// Default value is <see langword="null"/>.
139+
/// </para>
140+
[AddedVersion("2.1.0")]
141+
[DefaultValue(null)]
142+
[Description("Gets or sets the badge text.")]
136143
[Parameter]
137144
public string? BadgeText { get; set; }
138145

139146
/// <summary>
140147
/// Gets or sets the custom icon name.
141148
/// </summary>
142-
/// <remarks>
143-
/// Default value is null.
144-
/// </remarks>
149+
/// <para>
150+
/// Default value is <see langword="null"/>.
151+
/// </para>
152+
[AddedVersion("2.1.0")]
153+
[DefaultValue(null)]
154+
[Description("Gets or sets the custom icon name.")]
145155
[Parameter]
146156
public string? CustomIconName { get; set; }
147157

148158
/// <summary>
149159
/// Gets or sets the data provider.
150160
/// </summary>
151-
/// <remarks>
152-
/// Default value is null.
153-
/// </remarks>
154-
[Parameter]
161+
/// <para>
162+
/// Default value is <see langword="null"/>.
163+
/// </para>
164+
[AddedVersion("2.1.0")]
165+
[DefaultValue(null)]
166+
[Description("Gets or sets the data provider.")]
155167
[EditorRequired]
156-
public Sidebar2DataProviderDelegate? DataProvider { get; set; } = default!;
168+
[Parameter]
169+
public Sidebar2DataProviderDelegate? DataProvider { get; set; }
157170

158171
/// <summary>
159172
/// Gets or sets the Href.
160173
/// </summary>
161-
/// <remarks>
174+
/// <para>
162175
/// Default value is <see cref="string.Empty" />.
163-
/// </remarks>
176+
/// </para>
177+
[AddedVersion("3.0.0")]
178+
[DefaultValue("Empty string")]
179+
[Description("Gets or sets the Href.")]
164180
[Parameter]
165181
public string? Href { get; set; } = string.Empty;
166182

167183
/// <summary>
168184
/// Gets or sets the IconName.
169185
/// </summary>
170-
/// <remarks>
186+
/// <para>
171187
/// Default value is <see cref="IconName.None" />.
172-
/// </remarks>
188+
/// </para>
189+
[AddedVersion("2.1.0")]
190+
[DefaultValue(IconName.None)]
191+
[Description("Gets or sets the IconName.")]
173192
[Parameter]
174193
public IconName IconName { get; set; }
175194

176195
/// <summary>
177-
/// Gets or sets the sidebar logo.
196+
/// Gets or sets the <see cref="Sidebar2"/> logo.
178197
/// </summary>
179-
/// <remarks>
180-
/// Default value is null.
181-
/// </remarks>
198+
/// <para>
199+
/// Default value is <see langword="null"/>.
200+
/// </para>
201+
[AddedVersion("2.1.0")]
202+
[DefaultValue(null)]
203+
[Description("Gets or sets the <b>Sidebar2</b> logo.")]
182204
[Parameter]
183205
public string? ImageSrc { get; set; }
184206

185207
/// <summary>
186208
/// Gets or sets the width of the image in pixels.
187209
/// You can change the unit by setting <see cref="WidthUnit" />.
188-
/// <remarks>Default value is 0.</remarks>
210+
/// <para>
211+
/// Default value is 0.
212+
/// </para>
189213
/// </summary>
214+
[AddedVersion("3.4.0")]
215+
[DefaultValue(0)]
216+
[Description("Gets or sets the width of the image in pixels. You can change the unit by setting <b>WidthUnit</b>.")]
190217
[Parameter]
191218
public float ImageWidth { get; set; } = 0;
192219

193220
private string? navMenuCssClass => GetNavMenuCssClass();
194221

195222
/// <summary>
196-
/// Gets or sets the sidebar title.
223+
/// Gets or sets the <see cref="Sidebar2"/> title.
197224
/// </summary>
198-
/// <remarks>
199-
/// Default value is null.
200-
/// </remarks>
225+
/// <para>
226+
/// Default value is <see langword="null"/>.
227+
/// </para>
228+
[AddedVersion("2.1.0")]
229+
[DefaultValue(null)]
230+
[Description("Gets or sets the <b>Sidebar2</b> title.")]
201231
[Parameter]
202-
public string? Title { get; set; } = default!;
232+
public string? Title { get; set; }
203233

204234
/// <summary>
205-
/// Gets or sets the sidebar width.
235+
/// Gets or sets the <see cref="Sidebar2"/> width.
206236
/// </summary>
207-
/// <remarks>Default value is 270.</remarks>
237+
/// <para>
238+
/// Default value is 270.
239+
/// </para>
240+
[AddedVersion("3.0.0")]
241+
[DefaultValue(270)]
242+
[Description("Gets or sets the <b>Sidebar2</b> width.")]
208243
[Parameter]
209244
public float Width { get; set; } = 270;
210245

211246
/// <summary>
212-
/// Gets or sets the sidebar width unit.
247+
/// Gets or sets the <see cref="Sidebar2"/> width unit.
213248
/// </summary>
214-
/// <remarks>Default value is <see cref="Unit.Px" />.</remarks>
249+
/// <para>
250+
/// Default value is <see cref="Unit.Px" />.
251+
/// </para>
252+
[AddedVersion("3.0.0")]
253+
[DefaultValue(Unit.Px)]
254+
[Description("Gets or sets the <b>Sidebar2</b> width unit.")]
215255
[Parameter]
216256
public Unit WidthUnit { get; set; } = Unit.Px;
217257

0 commit comments

Comments
 (0)