@namespace Connected.Components
@inherits UIComponent

<Dialog @attributes="CustomAttributes">
    <TitleContent>
        @if (TitleContent == null)
        {
            <TextContent Typo="Typo.h6">@Title</TextContent> }
        else
        {
            @TitleContent
        }
    </TitleContent>
    <DialogContent>
        @if(MessageContent!=null)
        {
            @MessageContent
        }
        else
        {
            @MarkupMessage
            @Message
        }
    </DialogContent>
    <DialogActions>
        <div tabindex="-1" @onkeydown="HandleKeyDown">
            <FocusTrap DefaultFocus="DefaultFocus.LastChild">
                @if (CancelButton != null)
                {
                    <CascadingValue Value="@_cancelCallback">
                        @CancelButton
                    </CascadingValue>
                }
                else if (!string.IsNullOrWhiteSpace(CancelText))
                {
                    <Button OnClick="OnCancelClicked">@CancelText</Button>
                }
                @if (NoButton != null)
                {
                    <CascadingValue Value="@_noCallback">
                        @NoButton
                    </CascadingValue>
                }
                else if (!string.IsNullOrWhiteSpace(NoText))
                {
                    <MudButton OnClick="OnNoClicked">@NoText</MudButton>
                }
                @if (YesButton != null)
                {
                    <CascadingValue Value="@_yesCallback">
                        @YesButton
                    </CascadingValue>
                }
                else if (!string.IsNullOrWhiteSpace(YesText))
                {
                    <Button Color="ThemeColor.Primary" OnClick="OnYesClicked">@YesText</Button>
                }
            </FocusTrap>
        </div>
        
    </DialogActions>
</Dialog>
