From ee07cd7ce9d9ff2114063677abbd809c65809b2c Mon Sep 17 00:00:00 2001 From: Matija Gluhak Date: Fri, 10 Mar 2023 13:33:06 +0100 Subject: [PATCH] adding custom icon implementation --- samples/BlazorServer/BlazorServer.csproj | 8 + samples/BlazorServer/Pages/Index.razor | 9 +- samples/BlazorServer/wwwroot/blazoredIcon.svg | 852 ++++++++++++++++++ .../BlazorWebAssembly.csproj | 8 + samples/BlazorWebAssembly/Pages/Index.razor | 5 + .../wwwroot/blazoredIcon.svg | 852 ++++++++++++++++++ src/Blazored.Toast/BlazoredToast.razor | 3 + src/Blazored.Toast/BlazoredToast.razor.cs | 1 + 8 files changed, 1737 insertions(+), 1 deletion(-) create mode 100644 samples/BlazorServer/wwwroot/blazoredIcon.svg create mode 100644 samples/BlazorWebAssembly/wwwroot/blazoredIcon.svg diff --git a/samples/BlazorServer/BlazorServer.csproj b/samples/BlazorServer/BlazorServer.csproj index 2549b07..51102bd 100644 --- a/samples/BlazorServer/BlazorServer.csproj +++ b/samples/BlazorServer/BlazorServer.csproj @@ -4,6 +4,14 @@ net7.0 + + + + + + + + diff --git a/samples/BlazorServer/Pages/Index.razor b/samples/BlazorServer/Pages/Index.razor index bb0480e..a459fc0 100644 --- a/samples/BlazorServer/Pages/Index.razor +++ b/samples/BlazorServer/Pages/Index.razor @@ -12,11 +12,15 @@ +
+
@@ -25,6 +29,7 @@
+dasdasd

Blazored Toasts - Remove Toasts

@@ -45,13 +50,15 @@ { private ToastParameters _toastParameters; + private string customIconHtml => $""; + protected override void OnInitialized() { _toastParameters = new ToastParameters(); _toastParameters.Add(nameof(MyToastComponent.Title), "I'm a custom toast component with parameters"); _toastParameters.Add(nameof(MyToastComponent.ToastParam), "I'm a parameter"); } - + private void OnShowHtml() { RenderFragment message =@I'm an INFO message with some bold text diff --git a/samples/BlazorServer/wwwroot/blazoredIcon.svg b/samples/BlazorServer/wwwroot/blazoredIcon.svg new file mode 100644 index 0000000..986e9bc --- /dev/null +++ b/samples/BlazorServer/wwwroot/blazoredIcon.svg @@ -0,0 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/BlazorWebAssembly/BlazorWebAssembly.csproj b/samples/BlazorWebAssembly/BlazorWebAssembly.csproj index ebf5dc5..49f58c0 100644 --- a/samples/BlazorWebAssembly/BlazorWebAssembly.csproj +++ b/samples/BlazorWebAssembly/BlazorWebAssembly.csproj @@ -6,6 +6,14 @@ enable + + + + + + + + diff --git a/samples/BlazorWebAssembly/Pages/Index.razor b/samples/BlazorWebAssembly/Pages/Index.razor index 32c4a60..1f96655 100644 --- a/samples/BlazorWebAssembly/Pages/Index.razor +++ b/samples/BlazorWebAssembly/Pages/Index.razor @@ -16,6 +16,9 @@ +
@@ -54,6 +57,8 @@ { private ToastParameters _toastParameters = default!; + private string customIconHtml => $""; + protected override void OnInitialized() { _toastParameters = new ToastParameters() diff --git a/samples/BlazorWebAssembly/wwwroot/blazoredIcon.svg b/samples/BlazorWebAssembly/wwwroot/blazoredIcon.svg new file mode 100644 index 0000000..986e9bc --- /dev/null +++ b/samples/BlazorWebAssembly/wwwroot/blazoredIcon.svg @@ -0,0 +1,852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Blazored.Toast/BlazoredToast.razor b/src/Blazored.Toast/BlazoredToast.razor index 906ab0f..b111d58 100644 --- a/src/Blazored.Toast/BlazoredToast.razor +++ b/src/Blazored.Toast/BlazoredToast.razor @@ -64,6 +64,9 @@ else case IconType.Material: break; + case IconType.Custom: + @((MarkupString)Settings.Icon!); + break; }
} diff --git a/src/Blazored.Toast/BlazoredToast.razor.cs b/src/Blazored.Toast/BlazoredToast.razor.cs index 771aa00..b43de20 100644 --- a/src/Blazored.Toast/BlazoredToast.razor.cs +++ b/src/Blazored.Toast/BlazoredToast.razor.cs @@ -83,6 +83,7 @@ private bool ShowIconDiv() IconType.Blazored => true, IconType.FontAwesome => !string.IsNullOrWhiteSpace(Settings.Icon), IconType.Material => !string.IsNullOrWhiteSpace(Settings.Icon), + IconType.Custom => !string.IsNullOrWhiteSpace(Settings.Icon), _ => false };