@namespace Lumeo

<div class="@CssClass" @attributes="AdditionalAttributes">@ChildContent</div>

@code {
    [Parameter] public string? MaxWidth { get; set; } = "lg";
    [Parameter] public bool Center { get; set; } = true;
    [Parameter] public string? Padding { get; set; } = "4";
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public string? Class { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object>? AdditionalAttributes { get; set; }

    private string CssClass
    {
        get
        {
            var maxWidth = !string.IsNullOrEmpty(MaxWidth) ? $"max-w-{MaxWidth}" : "";
            var center = Center ? "mx-auto" : "";
            var padding = !string.IsNullOrEmpty(Padding) ? $"px-{Padding}" : "";
            return $"w-full {maxWidth} {center} {padding} {Class}".Trim();
        }
    }
}
