1
0
mirror of synced 2024-12-11 22:16:00 +01:00
GC-local-server-rewrite/MudAdmin/Shared/MainLayout.razor
jiych1 14261c8e29 Change avatar/navigator/title select method
Add the function to change player name
2022-07-07 21:46:17 +08:00

60 lines
2.1 KiB
Plaintext

@inherits LayoutComponentBase
<MudThemeProvider @ref="@MudThemeProvider" @bind-IsDarkMode="@IsDarkMode"/>
<MudDialogProvider/>
<MudSnackbarProvider/>
<MudLayout>
<MudAppBar Elevation="0" Dense="true">
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start"
OnClick="@((e) => DrawerToggle())"/>
<MudSpacer/>
<MudTooltip Duration="1000" Text="Powered by MudBlazor">
<MudIconButton Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Inherit"
Link="https://mudblazor.com/" Target="_blank"/>
</MudTooltip>
<MudTooltip Duration="1000" Text="Github Repository">
<MudIconButton Icon="@Icons.Custom.Brands.GitHub" Color="Color.Inherit"
Link="https://github.com/asesidaa/GC-local-server-rewrite/" Target="_blank"/>
</MudTooltip>
<MudTooltip Duration="1000" Text="@(IsDarkMode ? "Switch to Light Mode" : "Switch to DarkMode")">
<MudToggleIconButton @bind-Toggled="@IsDarkMode"
Icon="@Icons.Material.Outlined.DarkMode" Color="Color.Inherit"
ToggledIcon="@Icons.Material.Filled.LightMode"/>
</MudTooltip>
</MudAppBar>
<MudDrawer @bind-Open="drawerOpen" Elevation="1">
<MudDrawerHeader>
<MudText Typo="Typo.h6">GC local server Admin</MudText>
</MudDrawerHeader>
<NavMenu/>
</MudDrawer>
<MudMainContent>
<MudContainer MaxWidth="MaxWidth.Large" Class="my-16 pt-16">
@Body
</MudContainer>
</MudMainContent>
</MudLayout>
@code {
bool drawerOpen = true;
public bool IsDarkMode { get; set; }
public MudThemeProvider MudThemeProvider { get; set; } = null!;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
IsDarkMode = await MudThemeProvider.GetSystemPreference();
StateHasChanged();
}
}
void DrawerToggle()
{
drawerOpen = !drawerOpen;
}
}