Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: MudDrawer: Added XML Documentation for Public Members #8955

Merged
merged 13 commits into from
May 14, 2024
Merged
108 changes: 72 additions & 36 deletions src/MudBlazor/Components/Drawer/MudDrawer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
namespace MudBlazor
{
#nullable enable
/// <summary>
/// Represents a navigation panel docked to the side of the page.
/// </summary>
public partial class MudDrawer : MudComponentBase, INavigationEventReceiver, IBrowserViewportObserver, IDisposable
{
private double _height;
Expand Down Expand Up @@ -88,29 +91,41 @@ public MudDrawer()
private bool RightToLeft { get; set; }

/// <summary>
/// If true, drawer position will be fixed. (CSS position: fixed;)
/// Shows the drawer in the same position even if the page is scrolled.
/// </summary>
/// <remarks>
/// Defaults to <c>true</c>.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public bool Fixed { get; set; } = true;

/// <summary>
/// The higher the number, the heavier the drop-shadow. 0 for no shadow.
/// The size of the drop shadow.
/// </summary>
/// <remarks>
/// Defaults to <c>4</c>. A higher number creates a heavier drop shadow. Use a value of <c>0</c> for no shadow.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Appearance)]
public int Elevation { set; get; } = 1;

/// <summary>
/// Side from which the drawer will appear.
/// The edge of the container that the drawer will appear.
/// </summary>
/// <remarks>
/// Defaults to <see cref="Anchor.Start" />.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public Anchor Anchor { get; set; } = Anchor.Start;

/// <summary>
/// The color of the component. It supports the theme colors.
/// The color of the drawer.
/// </summary>
/// <remarks>
/// Defaults to <see cref="Color.Default"/>. Theme colors are supported.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Appearance)]
public Color Color { get; set; } = Color.Default;
Expand All @@ -123,89 +138,110 @@ public MudDrawer()
public DrawerVariant Variant { get; set; } = DrawerVariant.Responsive;

/// <summary>
/// Child content of component.
/// The content within this component.
/// </summary>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// Show overlay for responsive and temporary drawers.
/// For responsive and temporary drawers, darkens the screen with an overlay when displaying this drawer.
/// </summary>
/// <remarks>
/// Defaults to <c>true</c>. Applies when <see cref="Variant"/> is <see cref="DrawerVariant.Responsive"/> or <see cref="DrawerVariant.Temporary"/>.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public bool Overlay { get; set; } = true;

/// <summary>
/// Open drawer automatically on mouse enter when <see cref="Variant" /> parameter is set to <see cref="DrawerVariant.Mini" />.
/// For mini drawers, opens this drawer when the mouse hovers over it.
/// </summary>
/// <remarks>
/// Defaults to <c>false</c>. Applies when <see cref="Variant" /> is set to <see cref="DrawerVariant.Mini" />.
jperson2000 marked this conversation as resolved.
Show resolved Hide resolved
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public bool OpenMiniOnHover { get; set; }

/// <summary>
/// Switching point for responsive drawers
/// The browser width at which responsive drawers are hidden.
/// </summary>
/// <remarks>
/// The <see cref="Breakpoint"/> enum represents the breakpoints at which the drawer behavior changes. Supported breakpoints are:
/// <list type="bullet">
/// <item><description><see cref="Breakpoint.Xs"/></description></item>
/// <item><description><see cref="Breakpoint.Sm"/></description></item>
/// <item><description><see cref="Breakpoint.Md"/></description></item>
/// <item><description><see cref="Breakpoint.Lg"/></description></item>
/// <item><description><see cref="Breakpoint.Xl"/></description></item>
/// <item><description><see cref="Breakpoint.Xxl"/></description></item>
/// </list>
/// For convenience, other breakpoint combinations are aliased as follows:
jperson2000 marked this conversation as resolved.
Show resolved Hide resolved
/// <list type="bullet">
/// <item><description><see cref="Breakpoint.SmAndDown"/>: Aliases to <see cref="Breakpoint.Sm"/></description></item>
/// <item><description><see cref="Breakpoint.MdAndDown"/>: Aliases to <see cref="Breakpoint.Md"/></description></item>
/// <item><description><see cref="Breakpoint.LgAndDown"/>: Aliases to <see cref="Breakpoint.Lg"/></description></item>
/// <item><description><see cref="Breakpoint.XlAndDown"/>: Aliases to <see cref="Breakpoint.Xl"/></description></item>
/// <item><description><see cref="Breakpoint.SmAndUp"/>: Aliases to <see cref="Breakpoint.Sm"/></description></item>
/// <item><description><see cref="Breakpoint.MdAndUp"/>: Aliases to <see cref="Breakpoint.Md"/></description></item>
/// <item><description><see cref="Breakpoint.LgAndUp"/>: Aliases to <see cref="Breakpoint.Lg"/></description></item>
/// <item><description><see cref="Breakpoint.XlAndUp"/>: Aliases to <see cref="Breakpoint.Xl"/></description></item>
/// </list>
/// Setting the value to <see cref="Breakpoint.None"/> will always close the drawer, while <see cref="Breakpoint.Always"/> will always keep it open.
/// </remarks>
/// <remarks>
/// Defaults to <see cref="Breakpoint.Md"/>. Supported breakpoints are:
/// <list type="bullet">
/// <item><description><see cref="Breakpoint.Xs"/></description></item>
/// <item><description><see cref="Breakpoint.Sm"/></description></item>
/// <item><description><see cref="Breakpoint.Md"/></description></item>
/// <item><description><see cref="Breakpoint.Lg"/></description></item>
/// <item><description><see cref="Breakpoint.Xl"/></description></item>
/// <item><description><see cref="Breakpoint.Xxl"/></description></item>
/// </list>
/// Other breakpoint combinations are aliased as follows:
/// <list type="bullet">
/// <item><description><see cref="Breakpoint.SmAndDown"/>: Aliases to <see cref="Breakpoint.Sm"/></description></item>
/// <item><description><see cref="Breakpoint.MdAndDown"/>: Aliases to <see cref="Breakpoint.Md"/></description></item>
/// <item><description><see cref="Breakpoint.LgAndDown"/>: Aliases to <see cref="Breakpoint.Lg"/></description></item>
/// <item><description><see cref="Breakpoint.XlAndDown"/>: Aliases to <see cref="Breakpoint.Xl"/></description></item>
/// <item><description><see cref="Breakpoint.SmAndUp"/>: Aliases to <see cref="Breakpoint.Sm"/></description></item>
/// <item><description><see cref="Breakpoint.MdAndUp"/>: Aliases to <see cref="Breakpoint.Md"/></description></item>
/// <item><description><see cref="Breakpoint.LgAndUp"/>: Aliases to <see cref="Breakpoint.Lg"/></description></item>
/// <item><description><see cref="Breakpoint.XlAndUp"/>: Aliases to <see cref="Breakpoint.Xl"/></description></item>
/// </list>
/// Setting the value to <see cref="Breakpoint.None"/> will always close the drawer, while <see cref="Breakpoint.Always"/> will always keep it open.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public Breakpoint Breakpoint { get; set; } = Breakpoint.Md;

/// <summary>
/// Sets the opened state on the drawer. Can be used with two-way binding to close itself on navigation.
/// Displays this drawer.
/// </summary>
/// <remarks>
/// Defaults to <c>false</c>. Raises the <see cref="OpenChanged"/> event upon change. When bound via <c>@bind-Open</c>, this property is updated when this drawer closes itself.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public bool Open { get; set; }

/// <summary>
/// Occurs when the <see cref="Open"/> value has changed.
/// </summary>
[Parameter]
public EventCallback<bool> OpenChanged { get; set; }

/// <summary>
/// Width of left/right drawer. Only for non-fixed drawers.
/// For non-fixed or temporary drawers, the width of this drawer.
/// </summary>
/// <remarks>
/// Defaults to <c>null</c>. Values such as <c>300px</c> and <c>30%</c> are supported. Applies to non-fixed or <see cref="DrawerVariant.Temporary"/> drawers anchored to the left or right.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Appearance)]
public string? Width { get; set; }

/// <summary>
/// Width of left/right drawer. Only for non-fixed drawers.
/// For mini drawers, the width of this drawer.
/// </summary>
/// <remarks>
/// Defaults to <c>null</c>. Values such as <c>300px</c> and <c>30%</c> are supported. Applies to <see cref="DrawerVariant.Mini"/> drawers achored to the left or right.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Appearance)]
public string? MiniWidth { get; set; }

/// <summary>
/// Height of top/bottom temporary drawer
/// The height of this drawer.
/// </summary>
/// <remarks>
/// Defaults to <c>null</c>. Values such as <c>300px</c> and <c>30%</c> are supported. Applies to drawers achored to the top or bottom.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Appearance)]
public string? Height { get; set; }

/// <summary>
/// Specify how the drawer should behave inside a MudLayout. It affects the position relative to <see cref="MudAppBar"/>.
/// The position of this drawer when opened, relative to a <see cref="MudAppBar"/> when inside a <see cref="MudLayout"/>.
/// </summary>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
Expand Down
6 changes: 6 additions & 0 deletions src/MudBlazor/Components/Drawer/MudDrawerContainer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
namespace MudBlazor
{
#nullable enable
/// <summary>
/// Represents a container for a <see cref="MudDrawer"/> component.
/// </summary>
public partial class MudDrawerContainer : MudComponentBase
{
protected bool Fixed { get; set; } = false;
Expand All @@ -31,6 +34,9 @@ public partial class MudDrawerContainer : MudComponentBase
[CascadingParameter(Name = "RightToLeft")]
public bool RightToLeft { get; set; }

/// <summary>
/// Custom content within this component.
/// </summary>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public RenderFragment? ChildContent { get; set; }
Expand Down
31 changes: 0 additions & 31 deletions src/MudBlazor/Components/Drawer/MudDrawerHeader.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@namespace MudBlazor
@using MudBlazor.Utilities
@inherits MudComponentBase

@if (LinkToIndex)
Expand All @@ -14,33 +13,3 @@ else
@ChildContent
</div>
}

@code {
#nullable enable
protected string Classname =>
new CssBuilder("mud-drawer-header")
.AddClass($"mud-drawer-header-dense", Dense)
.AddClass(Class)
.Build();

/// <summary>
/// If true, compact padding will be used, same as the Appbar.
/// </summary>
[Parameter]
[Category(CategoryTypes.Drawer.Appearance)]
public bool Dense { get; set; }

/// <summary>
/// If true, the component will link to index page with an a element instead of div.
/// </summary>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public bool LinkToIndex { get; set; }

/// <summary>
/// Child content of component.
/// </summary>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public RenderFragment? ChildContent { get; set; }
}
49 changes: 49 additions & 0 deletions src/MudBlazor/Components/Drawer/MudDrawerHeader.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (c) MudBlazor 2021
// MudBlazor licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.AspNetCore.Components;
using MudBlazor.Utilities;

namespace MudBlazor;

#nullable enable

/// <summary>
/// Represents content at the top of a <see cref="MudDrawer"/>.
/// </summary>
public partial class MudDrawerHeader
{
protected string Classname =>
new CssBuilder("mud-drawer-header")
.AddClass($"mud-drawer-header-dense", Dense)
.AddClass(Class)
.Build();

/// <summary>
/// Uses compact padding.
/// </summary>
/// <remarks>
/// Defaults to <c>false</c>.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Appearance)]
public bool Dense { get; set; }

/// <summary>
/// Navigates to the index page on click.
/// </summary>
/// <remarks>
/// Defaults to <c>false</c>. When <c>true</c>, the component will link to index page upon click.
/// </remarks>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public bool LinkToIndex { get; set; }

/// <summary>
/// Custom content within this component.
/// </summary>
[Parameter]
[Category(CategoryTypes.Drawer.Behavior)]
public RenderFragment? ChildContent { get; set; }
}
63 changes: 47 additions & 16 deletions src/MudBlazor/Enums/Anchor.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
using System.ComponentModel;

namespace MudBlazor
namespace MudBlazor;

/// <summary>
/// Indicates the edge of a conainter that a component will appear.
/// </summary>
public enum Anchor
{
public enum Anchor
{
[Description("left")]
Left,
[Description("right")]
Right,
[Description("start")]
Start,
[Description("end")]
End,
[Description("top")]
Top,
[Description("bottom")]
Bottom
}
/// <summary>
/// The component will display on the left edge.
/// </summary>
[Description("left")]
Left,

/// <summary>
/// The component will display on the right edge.
/// </summary>
[Description("right")]
Right,

/// <summary>
/// The component will display based on Right-to-Left (RTL) language settings.
/// </summary>
/// <remarks>
/// When RTL is enabled, the component is displayed on the right edge, otherwise the left edge.
/// </remarks>
[Description("start")]
Start,

/// <summary>
/// The component will display based on Right-to-Left (RTL) language settings.
/// </summary>
/// <remarks>
/// When RTL is enabled, the component is displayed on the left edge, otherwise the right edge.
/// </remarks>
[Description("end")]
End,

/// <summary>
/// The component will display on the top of the container.
/// </summary>
[Description("top")]
Top,

/// <summary>
/// The component will display on the bottom of the container.
/// </summary>
[Description("bottom")]
Bottom
}
Loading
Loading