// 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 Connected.Annotations; using Connected.Extensions; using Connected.Utilities; using Microsoft.AspNetCore.Components; namespace Connected.Components; public partial class Stack : UIComponent { protected string Classname => new CssBuilder("d-flex") .AddClass($"flex-{(Row ? "row" : "column")}{(Reverse ? "-reverse" : string.Empty)}") .AddClass($"justify-{Justify?.ToDescriptionString()}", Justify != null) .AddClass($"align-{AlignItems?.ToDescriptionString()}", AlignItems != null) .AddClass($"gap-{Spacing}") .AddClass(Class) .Build(); /// /// If true, items will be placed horizontally in a row instead of vertically. /// [Parameter] [Category(CategoryTypes.Stack.Behavior)] public bool Row { get; set; } /// /// Reverses the order of its items. /// [Parameter] [Category(CategoryTypes.Stack.Behavior)] public bool Reverse { get; set; } /// /// Defines the spacing between its items. /// [Parameter] [Category(CategoryTypes.Stack.Behavior)] public int Spacing { get; set; } = 3; /// /// Defines the spacing between its items. /// [Parameter] [Category(CategoryTypes.Stack.Behavior)] public Justify? Justify { get; set; } /// /// Defines the spacing between its items. /// [Parameter] [Category(CategoryTypes.Stack.Behavior)] public AlignItems? AlignItems { get; set; } /// /// Child content of the component. /// [Parameter] [Category(CategoryTypes.Stack.Behavior)] public RenderFragment ChildContent { get; set; } }