@namespace Lumeo

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

@code {
    [Parameter] public string? Height { get; set; }
    [Parameter] public bool Inline { get; set; }
    [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 display = Inline ? "inline-flex" : "flex";
            var height = string.IsNullOrEmpty(Height) ? "h-full" : null;
            return string.Join(" ", new[] { display, "items-center justify-center", height, Class }.Where(s => !string.IsNullOrWhiteSpace(s)));
        }
    }

    private string? StyleAttribute => !string.IsNullOrEmpty(Height) ? $"height: {Height}" : null;
}
