<div class="modal" tabindex="-1" role="dialog" style="display:@modalDisplay; overflow: hidden">
    <div class="modal-container">
        <div class="modal__body">
            <div class="modal__body__header">
                <div class="modal__body__header__info">
                    <img src="img/user.svg" alt="">
                    <p>@Title</p>
                </div>
            </div>
            <div class="modal__body__container modal__body__container_noflex">
                <div class="modal__404__text__box">
                    @Body
                    <p class="modal__404__text">
                        @((MarkupString)message)
                    </p>                        
                </div>
            </div>
        </div>
        <a class="modal_close" style="cursor:pointer" @onclick="@Close">&#10006;</a>
    </div>
</div>

@code {
    [Inject]
    public IJSRuntime JsRuntime { get; set; }

    [Parameter]
    public RenderFragment Title { get; set; }

    [Parameter]
    public RenderFragment Body { get; set; }

    private string modalDisplay = "none;";
    private string message = "";

    public void Open(string message = "")
    {
        JsRuntime.InvokeVoidAsync("BodyScroll", false);
        modalDisplay = "block;";
        this.message = message;
    }

    public void Close()
    {
        JsRuntime.InvokeVoidAsync("BodyScroll", true);
        modalDisplay = "none";
    }
}
