diff --git a/BlazorFluentUI/Components/Layout/NavMenu.razor b/BlazorFluentUI/Components/Layout/NavMenu.razor index 94ac143..6af781e 100644 --- a/BlazorFluentUI/Components/Layout/NavMenu.razor +++ b/BlazorFluentUI/Components/Layout/NavMenu.razor @@ -68,6 +68,7 @@ HorizontalScroll Menu MessageBar + MessageBox diff --git a/BlazorFluentUI/Components/Pages/CompoMessageBox.razor b/BlazorFluentUI/Components/Pages/CompoMessageBox.razor new file mode 100644 index 0000000..e10ad1e --- /dev/null +++ b/BlazorFluentUI/Components/Pages/CompoMessageBox.razor @@ -0,0 +1,95 @@ +@page "/compomessagebox" + +@inject IDialogService DialogService; + +@rendermode RenderMode.InteractiveServer + +

MessageBox

+ +
+ The FluentMessageBox is a dialog that is used to display information with a specific intent to the user. + It uses the DialogService to display the dialog. +
+ + +

Message Service

+ + + Success + Warning + Error + Information + Confirmation + Long Information + Custom + +

+ Last result: @(canceled == null ? "" : (canceled == true ? "❎ Canceled" : "✅ OK")) +

+
+ +@code { + bool? canceled; + + async Task ShowSuccessAsync() + { + var dialog = await DialogService.ShowSuccessAsync("The action was a success"); + var result = await dialog.Result; + canceled = result.Cancelled; + } + + async Task ShowWarningAsync() + { + var dialog = await DialogService.ShowWarningAsync("The action was a warning"); + var result = await dialog.Result; + canceled = result.Cancelled; + } + + async Task ShowErrorAsync() + { + var dialog = await DialogService.ShowErrorAsync("The action was a error"); + var result = await dialog.Result; + canceled = result.Cancelled; + } + + async Task ShowInformationAsync() + { + var dialog = await DialogService.ShowInfoAsync("The action was a information"); + var result = await dialog.Result; + canceled = result.Cancelled; + } + + async Task ShowConfirmationAsync() + { + var dialog = await DialogService.ShowConfirmationAsync("Do you like Blazor?", "Sure!", "Nope!"); + var result = await dialog.Result; + canceled = result.Cancelled; + } + + async Task ShowLongInformationAsync() + { + var dialog = await DialogService.ShowInfoAsync("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"); + var result = await dialog.Result; + canceled = result.Cancelled; + } + + async Task ShowCustomMessageBoxAsync() + { + var dialog = await DialogService.ShowMessageBoxAsync(new DialogParameters() + { + Content = new MessageBoxContent + { + Title = "My title", + MarkupMessage = new MarkupString("My customized message"), + Icon = new Icons.Regular.Size24.Games(), + IconColor = Color.Success + }, + PrimaryAction = "Plus", + SecondaryAction = "Minus", + Width = "300px" + }); + + var result = await dialog.Result; + canceled = result.Cancelled; + } +} diff --git a/BlazorFluentUI/Components/Pages/Components/CompoMessageBar.razor b/BlazorFluentUI/Components/Pages/Components/CompoMessageBar.razor index fd0aec0..8c3900e 100644 --- a/BlazorFluentUI/Components/Pages/Components/CompoMessageBar.razor +++ b/BlazorFluentUI/Components/Pages/Components/CompoMessageBar.razor @@ -1,14 +1,13 @@ @page "/compomessagebar" @inject IMessageService MessageService; -@inject IDialogService DialogService; @rendermode RenderMode.InteractiveServer

MessageBar

- MessageBars are rendered by the <FluentMessageBarProvider />. + FluentMessageBars are rendered by the <FluentMessageBarProvider />. This component needs to be added to the layout of application/site.