diff --git a/src/Blazored.Modal/Services/IModalService.cs b/src/Blazored.Modal/Services/IModalService.cs index 073686ad..515695a0 100644 --- a/src/Blazored.Modal/Services/IModalService.cs +++ b/src/Blazored.Modal/Services/IModalService.cs @@ -8,27 +8,27 @@ public interface IModalService /// /// Shows a modal containing the specified . /// - IModalReference Show() where TComponent : ComponentBase; + IModalReference Show() where TComponent : IComponent; /// /// Shows a modal containing a with the specified . /// /// Modal title - IModalReference Show(string title) where TComponent : ComponentBase; + IModalReference Show(string title) where TComponent : IComponent; /// /// Shows a modal containing a with the specified and . /// /// Modal title /// Options to configure the modal - IModalReference Show(string title, ModalOptions options) where TComponent : ComponentBase; + IModalReference Show(string title, ModalOptions options) where TComponent : IComponent; /// /// Shows a modal containing a with the specified and . /// /// Modal title /// Key/Value collection of parameters to pass to component being displayed - IModalReference Show(string title, ModalParameters parameters) where TComponent : ComponentBase; + IModalReference Show(string title, ModalParameters parameters) where TComponent : IComponent; /// /// Shows a modal containing a with the specified , @@ -37,7 +37,7 @@ public interface IModalService /// Modal title. /// Key/Value collection of parameters to pass to component being displayed. /// Options to configure the modal. - IModalReference Show(string title, ModalParameters parameters = null, ModalOptions options = null) where TComponent : ComponentBase; + IModalReference Show(string title, ModalParameters parameters = null, ModalOptions options = null) where TComponent : IComponent; /// /// Shows a modal containing a . @@ -55,16 +55,16 @@ public interface IModalService /// /// Shows a modal containing a with the specified and . /// - /// Modal title. /// Type of component to display. + /// Modal title. /// Options to configure the modal. IModalReference Show(Type component, string title, ModalOptions options); /// /// Shows a modal containing a with the specified and . /// - /// Modal title. /// Type of component to display. + /// Modal title. /// Key/Value collection of parameters to pass to component being displayed. IModalReference Show(Type component, string title, ModalParameters parameters); @@ -72,6 +72,7 @@ public interface IModalService /// Shows a modal containing a with the specified , /// and . /// + /// Type of component to display. /// Modal title. /// Key/Value collection of parameters to pass to component being displayed. /// Options to configure the modal. diff --git a/src/Blazored.Modal/Services/ModalService.cs b/src/Blazored.Modal/Services/ModalService.cs index 4521d760..d2d53aee 100644 --- a/src/Blazored.Modal/Services/ModalService.cs +++ b/src/Blazored.Modal/Services/ModalService.cs @@ -11,7 +11,7 @@ public class ModalService : IModalService /// /// Shows the modal with the component type. /// - public IModalReference Show() where T : ComponentBase + public IModalReference Show() where T : IComponent { return Show(string.Empty, new ModalParameters(), new ModalOptions()); } @@ -20,7 +20,7 @@ public IModalReference Show() where T : ComponentBase /// Shows the modal with the component type using the specified title. /// /// Modal title. - public IModalReference Show(string title) where T : ComponentBase + public IModalReference Show(string title) where T : IComponent { return Show(title, new ModalParameters(), new ModalOptions()); } @@ -30,7 +30,7 @@ public IModalReference Show(string title) where T : ComponentBase /// /// Modal title. /// Options to configure the modal. - public IModalReference Show(string title, ModalOptions options) where T : ComponentBase + public IModalReference Show(string title, ModalOptions options) where T : IComponent { return Show(title, new ModalParameters(), options); } @@ -41,7 +41,7 @@ public IModalReference Show(string title, ModalOptions options) where T : Com /// /// Modal title. /// Key/Value collection of parameters to pass to component being displayed. - public IModalReference Show(string title, ModalParameters parameters) where T : ComponentBase + public IModalReference Show(string title, ModalParameters parameters) where T : IComponent { return Show(title, parameters, new ModalOptions()); } @@ -53,7 +53,7 @@ public IModalReference Show(string title, ModalParameters parameters) where T /// Modal title. /// Key/Value collection of parameters to pass to component being displayed. /// Options to configure the modal. - public IModalReference Show(string title, ModalParameters parameters, ModalOptions options) where T : ComponentBase + public IModalReference Show(string title, ModalParameters parameters, ModalOptions options) where T : IComponent { return Show(typeof(T), title, parameters, options); } @@ -104,12 +104,13 @@ public IModalReference Show(Type contentComponent, string title, ModalParameters /// Shows the modal with the component type using the specified , /// passing the specified and setting a custom CSS style. /// + /// Type of component to display. /// Modal title. /// Key/Value collection of parameters to pass to component being displayed. /// Options to configure the modal. public IModalReference Show(Type contentComponent, string title, ModalParameters parameters, ModalOptions options) { - if (!typeof(ComponentBase).IsAssignableFrom(contentComponent)) + if (!typeof(IComponent).IsAssignableFrom(contentComponent)) { throw new ArgumentException($"{contentComponent.FullName} must be a Blazor Component"); }