@inherits LayoutComponentBase
@using MudBlazor

<MudThemeProvider @bind-IsDarkMode="@_isDarkMode" />
<MudDialogProvider />
<MudSnackbarProvider />
<MudPopoverProvider />

<MudLayout>
    <MudAppBar Color="Color.Primary" Fixed="true">
        <MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
        <MudText Typo="Typo.h6">CouchLog</MudText>
    </MudAppBar>

    <MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always" Elevation="1">
        <NavMenu />
    </MudDrawer>

    <MudMainContent>
        <MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="mt-4">
            @Body
        </MudContainer>
    </MudMainContent>
</MudLayout>

<div id="blazor-error-ui">
    An unhandled error has occurred.
    <a href="" class="reload">Reload</a>
    <a class="dismiss">🗙</a>
</div>

@code {
    bool _drawerOpen = true;
    bool _isDarkMode = true;

    void DrawerToggle()
    {
        _drawerOpen = !_drawerOpen;
    }
}