mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-23 04:52:22 +00:00
64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MudBlazor;
|
|
|
|
namespace Lantean.QBTMudBlade.Models
|
|
{
|
|
public record UIAction
|
|
{
|
|
private readonly Color _color;
|
|
|
|
public UIAction(string name, string text, string? icon, Color color, string href, bool separatorBefore = false)
|
|
{
|
|
Name = name;
|
|
Text = text;
|
|
Icon = icon;
|
|
_color = color;
|
|
Href = href;
|
|
SeparatorBefore = separatorBefore;
|
|
Children = [];
|
|
}
|
|
|
|
public UIAction(string name, string text, string? icon, Color color, EventCallback callback, bool separatorBefore = false)
|
|
{
|
|
Name = name;
|
|
Text = text;
|
|
Icon = icon;
|
|
_color = color;
|
|
Callback = callback;
|
|
SeparatorBefore = separatorBefore;
|
|
Children = [];
|
|
}
|
|
|
|
public UIAction(string name, string text, string? icon, Color color, IEnumerable<UIAction> children, bool useTextButton = false, bool separatorBefore = false)
|
|
{
|
|
Name = name;
|
|
Text = text;
|
|
Icon = icon;
|
|
_color = color;
|
|
Callback = default;
|
|
Children = children;
|
|
UseTextButton = useTextButton;
|
|
SeparatorBefore = separatorBefore;
|
|
}
|
|
|
|
public string Name { get; }
|
|
|
|
public string Text { get; }
|
|
|
|
public string? Icon { get; }
|
|
|
|
public Color Color => IsChecked is null || IsChecked.Value ? _color : Color.Transparent;
|
|
|
|
public EventCallback Callback { get; }
|
|
|
|
public string? Href { get; }
|
|
|
|
public bool SeparatorBefore { get; set; }
|
|
|
|
public IEnumerable<UIAction> Children { get; }
|
|
|
|
public bool UseTextButton { get; }
|
|
|
|
public bool? IsChecked { get; internal set; }
|
|
}
|
|
} |