@inherits LayoutComponentBase

<MudThemeProvider @bind-IsDarkMode="@_isDarkTheme" Theme="_theme"/>
<MudDialogProvider/>
<MudSnackbarProvider/>


<PageTitle>SharpRSS.Blazor</PageTitle>

<MudLayout>
    <MudAppBar>
        <MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => ToggleDrawer())"/>
        <MudText Typo="Typo.h6">SharpRSS</MudText>
        <MudSpacer/>
        <MudToggleIconButton @bind-Toggled="_isDarkTheme" Icon="@Icons.Material.Filled.DarkMode" ToggledIcon="@Icons.Material.Filled.LightMode"/>
    </MudAppBar>
    <MudDrawer @bind-Open="@_drawerOpen" ClipMode="DrawerClipMode.Always">
        <MudNavLink Href="/" Icon="@Icons.Material.Filled.Home">Home</MudNavLink>
    </MudDrawer>
    <MudMainContent>
        @Body
    </MudMainContent>
</MudLayout>

@code
{
    readonly MudTheme _theme = new MudTheme();
    bool _drawerOpen = true;
    bool _isDarkTheme = true;

    void ToggleDrawer() => _drawerOpen = !_drawerOpen;
}
