Skip to content

Commit

Permalink
refine xml comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stsrki committed Jan 12, 2025
1 parent ada4240 commit 791bfbe
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 46 deletions.
69 changes: 38 additions & 31 deletions Source/Blazorise/Components/Toast/ToastInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@
namespace Blazorise;

/// <summary>
/// Defines the message to show in the <see cref="Toast"/>.
/// Represents an instance of a toast message with associated properties and behavior.
/// </summary>
public class ToastInstance
{
/// <summary>
/// The constructor for the ToastInstance.
/// </summary>
/// <param name="toastProvider"></param>
/// <param name="toastId"></param>
/// <param name="title"></param>
/// <param name="message"></param>
/// <param name="intent"></param>
/// <param name="toastInstanceOptions"></param>
public ToastInstance( ToastProvider toastProvider, string toastId, string title, MarkupString message, ToastIntent intent, ToastInstanceOptions toastInstanceOptions )
/// Initializes a new instance of the <see cref="ToastInstance"/> class.
/// </summary>
/// <param name="toastProvider">The provider managing this toast instance.</param>
/// <param name="toastId">A unique identifier for this toast instance.</param>
/// <param name="title">The title text to display in the toast header.</param>
/// <param name="message">The body content to display in the toast.</param>
/// <param name="intent">The intent or purpose of the toast, which typically determines its styling.</param>
/// <param name="toastInstanceOptions">Optional settings to customize this toast instance.</param>
public ToastInstance(
ToastProvider toastProvider,
string toastId,
string title,
MarkupString message,
ToastIntent intent,
ToastInstanceOptions toastInstanceOptions )
{
ToastProvider = toastProvider;
ToastId = toastId;
Expand All @@ -32,42 +38,43 @@ public ToastInstance( ToastProvider toastProvider, string toastId, string title,
}

/// <summary>
/// The Toast provider.
/// The provider managing this toast instance.
/// </summary>
public ToastProvider ToastProvider { get; private set; }

/// <summary>
/// Tracks the Toast reference.
/// A reference to the toast component associated with this instance.
/// </summary>
public Toast ToastRef { get; set; }

/// <summary>
/// Tracks the Toast id.
/// A unique identifier for this toast instance.
/// </summary>
public string ToastId { get; set; }

/// <summary>
/// Control's the Toast visibility.
/// Indicates whether the toast is currently visible.
/// </summary>
public bool Visible { get; set; }

/// <summary>
/// Text to show in the toast header.
/// The title text displayed in the toast header.
/// </summary>
public string Title { get; set; }

/// <summary>
/// Text to show in the toast body.
/// The content displayed in the body of the toast.
/// </summary>
public MarkupString Message { get; set; }

/// <summary>
/// Intent of the toast message.
/// Specifies the intent or purpose of the toast.
/// This typically determines the styling or visual representation of the toast.
/// </summary>
public ToastIntent Intent { get; set; }

/// <summary>
/// Sets the options for ToastProvider.
/// Custom options for configuring this toast instance.
/// </summary>
public ToastInstanceOptions ToastInstanceOptions { get; private set; }

Expand All @@ -82,17 +89,17 @@ public ToastInstance( ToastProvider toastProvider, string toastId, string title,
public Func<ToastClosingEventArgs, Task> Closing => ToastInstanceOptions?.Closing ?? ToastProvider.Closing;

/// <summary>
/// Occurs after the toast has opened.
/// Occurs after the toast has successfully opened.
/// </summary>
public EventCallback Opened => ToastInstanceOptions?.Opened ?? ToastProvider.Opened;

/// <summary>
/// Occurs after the toast has closed.
/// Occurs after the toast has successfully closed.
/// </summary>
public EventCallback Closed => ToastInstanceOptions?.Closed ?? ToastProvider.Closed;

/// <summary>
/// Specifies whether the Toast should have an animated transition.
/// Specifies whether the toast should have an animated transition.
/// </summary>
public bool Animated => ToastInstanceOptions?.Animated ?? ToastProvider.Animated;

Expand All @@ -102,43 +109,43 @@ public ToastInstance( ToastProvider toastProvider, string toastId, string title,
public int AnimationDuration => ToastInstanceOptions?.AnimationDuration ?? ToastProvider.AnimationDuration;

/// <summary>
/// Automatically hide the toast after the delay.
/// Indicates whether the toast should automatically hide after a delay.
/// </summary>
public bool Autohide => ToastInstanceOptions?.Autohide ?? ToastProvider.Autohide;

/// <summary>
/// Delay in milliseconds before hiding the toast.
/// The delay in milliseconds before automatically hiding the toast.
/// </summary>
public double AutohideDelay => ToastInstanceOptions?.AutohideDelay ?? ToastProvider.AutohideDelay;

/// <summary>
/// Custom CSS class name to apply to the Toast
/// Custom CSS class name(s) applied to the toast.
/// </summary>
public string Class => ToastInstanceOptions?.Class;

/// <summary>
/// Custom inline styles to apply to the Toast
/// Custom inline styles applied to the toast.
/// </summary>
public string Style => ToastInstanceOptions?.Style;

/// <summary>
/// Determines whether to show an icon in the Toast. Defaults to true.
/// Indicates whether an icon should be displayed in the toast.
/// Defaults to <c>true</c>.
/// </summary>
public bool? ShowIcon => ToastInstanceOptions?.ShowIcon;

/// <summary>
/// Custom inline styles to apply to the icon in the Toast.
/// The style applied to the icon in the toast (e.g., solid, regular).
/// </summary>
public IconStyle? IconStyle => ToastInstanceOptions?.IconStyle;

/// <summary>
/// The size of the icon in the Toast.
/// The size of the icon displayed in the toast.
/// </summary>
public IconSize? IconSize => ToastInstanceOptions?.IconSize;

/// <summary>
/// Icon to display inside the ToastHeader.
/// The specific icon to display in the toast header.
/// </summary>
public IconName? IconName => ToastInstanceOptions?.IconName;

}
}
36 changes: 21 additions & 15 deletions Source/Blazorise/Models/ToastInstanceOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,85 +7,91 @@
namespace Blazorise;

/// <summary>
/// Sets the options for Toast instance.
/// Sets the options for a Toast instance.
/// </summary>
public class ToastInstanceOptions
{
/// <summary>
/// Occurs before the toast is opened.
/// Use this to intercept or modify the toast's behavior before it becomes visible.
/// </summary>
public Func<ToastOpeningEventArgs, Task> Opening { get; set; }

/// <summary>
/// Occurs before the toast is closed.
/// Use this to intercept or modify the toast's behavior before it is hidden.
/// </summary>
public Func<ToastClosingEventArgs, Task> Closing { get; set; }

/// <summary>
/// Occurs after the toast has opened.
/// Occurs after the toast has been successfully opened.
/// </summary>
public EventCallback? Opened { get; set; }

/// <summary>
/// Occurs after the toast has closed.
/// Occurs after the toast has been successfully closed.
/// </summary>
public EventCallback? Closed { get; set; }

/// <summary>
/// Specifies whether the Toast should have an animated transition.
/// Specifies whether the toast should use an animated transition.
/// If <c>true</c>, the toast will have smooth transitions during opening and closing.
/// </summary>
public bool? Animated { get; set; }

/// <summary>
/// The duration of the animation in milliseconds.
/// Applicable only when <see cref="Animated"/> is set to <c>true</c>.
/// </summary>
public int? AnimationDuration { get; set; }

/// <summary>
/// Automatically hide the toast after the delay.
/// Specifies whether the toast should automatically hide after a delay.
/// If <c>true</c>, the toast will disappear without user interaction.
/// </summary>
public bool? Autohide { get; set; }

/// <summary>
/// Delay in milliseconds before hiding the toast.
/// The delay in milliseconds before the toast is automatically hidden.
/// Only applicable when <see cref="Autohide"/> is set to <c>true</c>.
/// </summary>
public double? AutohideDelay { get; set; }

/// <summary>
/// Custom CSS class name to apply to the Toast
/// Custom CSS class name(s) to apply to the toast.
/// </summary>
public string Class { get; set; }

/// <summary>
/// Custom inline styles to apply to the Toast
/// Custom inline styles to apply to the toast.
/// </summary>
public string Style { get; set; }

/// <summary>
/// Icon to display inside the ToastHeader.
/// The icon to display inside the toast header.
/// </summary>
public IconName? IconName { get; set; }

/// <summary>
/// Determines whether to show an icon in the Toast.
/// Determines whether to display an icon in the toast.
/// </summary>
public bool? ShowIcon { get; set; }

/// <summary>
/// Style to apply to the icon in the Toast.
/// Specifies the style of the icon displayed in the toast.
/// </summary>
public IconStyle? IconStyle { get; set; }

/// <summary>
/// The size of the icon in the Toast.
/// The size of the icon displayed in the toast.
/// </summary>
public IconSize? IconSize { get; set; }

/// <summary>
/// Creates the default toast options.
/// Creates and returns the default options for a toast instance.
/// </summary>
/// <returns>Default toast options.</returns>
/// <returns>An instance of <see cref="ToastInstanceOptions"/> with default values.</returns>
public static ToastInstanceOptions Default => new()
{
};
}
}

0 comments on commit 791bfbe

Please sign in to comment.