From ab8400aa7abf370d9bc0f6214b1a4a4675e14195 Mon Sep 17 00:00:00 2001 From: Peace Date: Tue, 16 Jul 2024 10:21:40 +0900 Subject: [PATCH] app bar --- .../Components/Layout/MainLayout.razor | 1 - .../Components/Layout/NavMenu.razor | 1 + .../Pages/Components/CompoAppBar.razor | 85 +++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 BlazorFluentUI/Components/Pages/Components/CompoAppBar.razor diff --git a/BlazorFluentUI/Components/Layout/MainLayout.razor b/BlazorFluentUI/Components/Layout/MainLayout.razor index afffc42..7d12bad 100644 --- a/BlazorFluentUI/Components/Layout/MainLayout.razor +++ b/BlazorFluentUI/Components/Layout/MainLayout.razor @@ -14,7 +14,6 @@ @Body - diff --git a/BlazorFluentUI/Components/Layout/NavMenu.razor b/BlazorFluentUI/Components/Layout/NavMenu.razor index f1a130a..18551c6 100644 --- a/BlazorFluentUI/Components/Layout/NavMenu.razor +++ b/BlazorFluentUI/Components/Layout/NavMenu.razor @@ -45,6 +45,7 @@ Overview Accordion Anchor + AppBar diff --git a/BlazorFluentUI/Components/Pages/Components/CompoAppBar.razor b/BlazorFluentUI/Components/Pages/Components/CompoAppBar.razor new file mode 100644 index 0000000..fd5011c --- /dev/null +++ b/BlazorFluentUI/Components/Pages/Components/CompoAppBar.razor @@ -0,0 +1,85 @@ +@page "/compoappbar" + +@inject IDialogService DialogService; + +@rendermode RenderMode.InteractiveServer + +AppBar + +The FluentAppBar component is an implementation of the AppBar as you know from the Teams application. + +Default Example + + + + + + + + + + +

Message: @message?.ToString()

+ +
+ +@code { + private static Icon HomeIcon(bool active = false) => + active ? new Icons.Filled.Size24.Home() + : new Icons.Regular.Size24.Home(); + + private static Icon AppBarIcon(bool active = false) => + active ? new Icons.Filled.Size24.AppsList() + : new Icons.Regular.Size24.AppsList(); + + private static Icon WhatsNewIcon(bool active = false) => + active ? new Icons.Filled.Size24.Info() + : new Icons.Regular.Size24.Info(); + + private static Icon IconsIcon(bool active = false) => + active ? new Icons.Filled.Size24.Symbols() + : new Icons.Regular.Size24.Symbols(); + + private static Icon DialogIcon(bool active = false) => + active ? new Icons.Filled.Size24.AppGeneric() + : new Icons.Regular.Size24.AppGeneric(); + + string message = string.Empty; + void OnClick(IAppBarItem item) + { + message = $"{item.Text} clicked."; + } + + async Task ShowSuccessAsync(IAppBarItem item) + { + var dialog = await DialogService.ShowSuccessAsync($"You clicked {item.Text}."); + var result = await dialog.Result; + } + + async Task ShowWarningAsync(IAppBarItem item) + { + var dialog = await DialogService.ShowWarningAsync($"You clicked {item.Text}. Are you sure?"); + var result = await dialog.Result; + } +}