From 525241a92df846c0bbbe20960c1a520578f8189e Mon Sep 17 00:00:00 2001 From: AndriiSyrotenko Date: Mon, 18 Dec 2023 19:17:34 +0000 Subject: [PATCH] Add confirmation before deleting chat and UI fix --- .../Pages/ConfirmationModal.razor | 24 ++++++++++ .../Pages/ConfirmationModal.razor.css | 48 +++++++++++++++++++ .../Pages/_Host.cshtml | 2 + ShoppingAssistantWebClient.Web/Program.cs | 2 + .../Shared/MainLayout.razor | 2 + .../Shared/NavMenu.razor | 21 ++++++-- .../Shared/NavMenu.razor.css | 28 ++++++++--- .../ShoppingAssistantWebClient.Web.csproj | 1 + ShoppingAssistantWebClient.Web/_Imports.razor | 3 ++ 9 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor create mode 100644 ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor.css diff --git a/ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor b/ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor new file mode 100644 index 0000000..e43a5bb --- /dev/null +++ b/ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor @@ -0,0 +1,24 @@ + + + +@code { + [CascadingParameter] BlazoredModalInstance BlazoredModal { get; set; } = default!; + + private async Task Close() => await BlazoredModal.CloseAsync(ModalResult.Ok(true)); + private async Task ConfirmDelete() => await BlazoredModal.CloseAsync(ModalResult.Ok(true)); + private async Task Cancel() => await BlazoredModal.CloseAsync(ModalResult.Cancel()); + +} \ No newline at end of file diff --git a/ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor.css b/ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor.css new file mode 100644 index 0000000..a5ffb15 --- /dev/null +++ b/ShoppingAssistantWebClient.Web/Pages/ConfirmationModal.razor.css @@ -0,0 +1,48 @@ +.modal-dialog.modal-sm { + max-width: 300px; +} + +.medium-text { + font-size: 1rem; +} + +.btn-sm { + font-size: 0.9rem; + padding: 6px 12px; +} + +.btn-yes { + color: #FFFFFF; + background-color: #FF0000; +} + +.btn:active { + transform: scale(0.95); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); +} + +.btn:focus { + outline: none !important; + box-shadow: none !important; +} + +.modal-header, .modal-footer { + padding: 8px; +} + +@media (max-width: 600px) { + .modal-dialog { + max-width: 100%; + margin: 10px auto; + } + .modal-content { + margin: 0; + } +} + + +.close { + background: none; + border: none; + outline: none; +} \ No newline at end of file diff --git a/ShoppingAssistantWebClient.Web/Pages/_Host.cshtml b/ShoppingAssistantWebClient.Web/Pages/_Host.cshtml index 5f51717..f9403ad 100644 --- a/ShoppingAssistantWebClient.Web/Pages/_Host.cshtml +++ b/ShoppingAssistantWebClient.Web/Pages/_Host.cshtml @@ -12,6 +12,8 @@ + + diff --git a/ShoppingAssistantWebClient.Web/Program.cs b/ShoppingAssistantWebClient.Web/Program.cs index 4809cc6..b6e5e62 100644 --- a/ShoppingAssistantWebClient.Web/Program.cs +++ b/ShoppingAssistantWebClient.Web/Program.cs @@ -1,3 +1,4 @@ +using Blazored.Modal; using GraphQL.Client.Http; using ShoppingAssistantWebClient.Web.Configurations; using ShoppingAssistantWebClient.Web.Data; @@ -13,6 +14,7 @@ builder.Services.AddServerSideBlazor().AddCircuitOptions(options => { options.De builder.Services.AddSingleton(); builder.Services.AddApiClient(builder.Configuration); builder.Services.AddSingleton(); +builder.Services.AddBlazoredModal(); var app = builder.Build(); diff --git a/ShoppingAssistantWebClient.Web/Shared/MainLayout.razor b/ShoppingAssistantWebClient.Web/Shared/MainLayout.razor index 2b9f5d4..f1d0e4f 100644 --- a/ShoppingAssistantWebClient.Web/Shared/MainLayout.razor +++ b/ShoppingAssistantWebClient.Web/Shared/MainLayout.razor @@ -1,10 +1,12 @@ @inherits LayoutComponentBase @using ShoppingAssistantWebClient.Web.Pages +@using Blazored.Modal CARTAID +