@inject IJSRuntime JSRuntime

<style>
    .mud-input-label {
        background-color: #eee;
    }
</style>
<MudStack class="w-screen h-screen bg-[#356859]">
    <div class="flex flex-row mt-4 mb-3">
        @if (Header != null)
        {
            @Header
        }
        else
        {
            <MudStack Row="true" Class="mx-7 my-2">
                <MudStack class="justify-center ">
                    <p class="text-lg font-extrabold text-white font-iranyekan">@Title</p>
                    <p class="-mt-3 text-xs text-white font-iranyekan">@Description</p>
                </MudStack>
            </MudStack>
            <MudIconButton @onclick="BackClicked" Icon="@Icons.Material.TwoTone.ChevronLeft" class="w-10 h-10 my-auto ml-4 mr-auto font-extrabold bg-white rounded-full" />
        }
    </div>
    <div class="bg-[#EEEEEE] w-full h-full flex flex-col rounded-t-xl p-5">
        @ChildContent
    </div>
</MudStack>

@code
{
    [Parameter]
    public RenderFragment? ChildContent { get; set; }

    [Parameter]
    public RenderFragment? Header { get; set; }

    [Parameter]
    public string Title { get; set; } = string.Empty;

    [Parameter]
    public string Description { get; set; } = string.Empty;


    private async Task BackClicked()
    {
        await JSRuntime.InvokeVoidAsync("history.back");
    }
}
