From 91ea15a16e24aa09912685be2c87809e5ab3a053 Mon Sep 17 00:00:00 2001 From: Chris Sainty Date: Mon, 2 Oct 2023 22:14:11 +0100 Subject: [PATCH] Added new Show methods without title parameter (#532) --- .../BlazoredModalInstance.razor | 7 ++++-- src/Blazored.Modal/Services/IModalService.cs | 20 ++++++++++++++++ src/Blazored.Modal/Services/ModalService.cs | 23 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/Blazored.Modal/BlazoredModalInstance.razor b/src/Blazored.Modal/BlazoredModalInstance.razor index 21109a27..721cae30 100644 --- a/src/Blazored.Modal/BlazoredModalInstance.razor +++ b/src/Blazored.Modal/BlazoredModalInstance.razor @@ -15,10 +15,13 @@ else @if (!HideHeader) {
-

@Title

+ @if (!string.IsNullOrWhiteSpace(Title)) + { +

@Title

+ } @if (!HideCloseButton) { - } diff --git a/src/Blazored.Modal/Services/IModalService.cs b/src/Blazored.Modal/Services/IModalService.cs index 7385fd3d..4e14474c 100644 --- a/src/Blazored.Modal/Services/IModalService.cs +++ b/src/Blazored.Modal/Services/IModalService.cs @@ -8,6 +8,26 @@ public interface IModalService /// Shows a modal containing the specified . /// IModalReference Show() where TComponent : IComponent; + + /// + /// Shows a modal containing a with the specified . + /// + /// Options to configure the modal. + IModalReference Show(ModalOptions options) where TComponent : IComponent; + + /// + /// Shows a modal containing a with the specified . + /// + /// Key/Value collection of parameters to pass to component being displayed. + IModalReference Show(ModalParameters parameters) where TComponent : IComponent; + + /// + /// Shows a modal containing a with the specified + /// and . + /// + /// Key/Value collection of parameters to pass to component being displayed. + /// Options to configure the modal. + IModalReference Show(ModalParameters parameters, ModalOptions options) where TComponent : IComponent; /// /// Shows a modal containing a with the specified . diff --git a/src/Blazored.Modal/Services/ModalService.cs b/src/Blazored.Modal/Services/ModalService.cs index aa3469e5..c50a621d 100644 --- a/src/Blazored.Modal/Services/ModalService.cs +++ b/src/Blazored.Modal/Services/ModalService.cs @@ -13,6 +13,29 @@ public class ModalService : IModalService public IModalReference Show() where T : IComponent => Show(string.Empty, new ModalParameters(), new ModalOptions()); + /// + /// Shows a modal containing a with the specified . + /// + /// Options to configure the modal. + public IModalReference Show(ModalOptions options) where TComponent : IComponent + => Show("", new ModalParameters(), options); + + /// + /// Shows a modal containing a with the specified . + /// + /// Key/Value collection of parameters to pass to component being displayed. + public IModalReference Show(ModalParameters parameters) where TComponent : IComponent + => Show("", parameters, new ModalOptions()); + + /// + /// Shows a modal containing a with the specified + /// and . + /// + /// Key/Value collection of parameters to pass to component being displayed. + /// Options to configure the modal. + public IModalReference Show(ModalParameters parameters, ModalOptions options) where TComponent : IComponent + => Show("", parameters, options); + /// /// Shows the modal with the component type using the specified title. ///