From 2cea080a3483c3c65fe3502d212f9942fc110866 Mon Sep 17 00:00:00 2001 From: Felix-CodingClimber Date: Tue, 2 Apr 2024 16:39:49 +0200 Subject: [PATCH] Fixed unchanged background of DiffViewers. --- .../Components/Pages/DiffViewerExample.razor | 6 +++--- .../DiffViewer/CompactDiffViewer.razor | 6 ++++-- .../DiffViewer/SideBySideDiffViewer.razor | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/samples/DotNetElements.CrudExample/Components/Pages/DiffViewerExample.razor b/samples/DotNetElements.CrudExample/Components/Pages/DiffViewerExample.razor index 6a0f166..3413073 100644 --- a/samples/DotNetElements.CrudExample/Components/Pages/DiffViewerExample.razor +++ b/samples/DotNetElements.CrudExample/Components/Pages/DiffViewerExample.razor @@ -16,7 +16,7 @@ - + @@ -38,7 +38,7 @@ private SideBySideDiffModel? sideBySideDiff; private string? textA = -@"unchanged 1 + @"unchanged 1 unchanged 2 Huhu 1 test abc test1 abc @@ -46,7 +46,7 @@ deleted here is a unchanged line"; private string? textB = -@"unchanged 1 + @"unchanged 1 unchanged 2 Huhu 2 blub abc test2 abc diff --git a/src/DotNetElements.Web.Blazor/DiffViewer/CompactDiffViewer.razor b/src/DotNetElements.Web.Blazor/DiffViewer/CompactDiffViewer.razor index 34ae6ca..f06b9ca 100644 --- a/src/DotNetElements.Web.Blazor/DiffViewer/CompactDiffViewer.razor +++ b/src/DotNetElements.Web.Blazor/DiffViewer/CompactDiffViewer.razor @@ -1,8 +1,10 @@ @using DotNetElements.Core.StringDiff +@inherits MudComponentBase + @if (Diff?.HasDifferences is true) { - +
@@ -58,6 +60,6 @@ else private string GetOldDiffLineBackground(DiffPiece diffLine) { - return diffLine.Type is ChangeType.Unchanged ? DnePalette.DiffLineUnchanged.ToString() : $"var({DnePalette.DiffLineOld})"; + return diffLine.Type is ChangeType.Unchanged ? $"var({DnePalette.DiffLineUnchanged})" : $"var({DnePalette.DiffLineOld})"; } } diff --git a/src/DotNetElements.Web.Blazor/DiffViewer/SideBySideDiffViewer.razor b/src/DotNetElements.Web.Blazor/DiffViewer/SideBySideDiffViewer.razor index fc22a4f..8a77803 100644 --- a/src/DotNetElements.Web.Blazor/DiffViewer/SideBySideDiffViewer.razor +++ b/src/DotNetElements.Web.Blazor/DiffViewer/SideBySideDiffViewer.razor @@ -1,8 +1,10 @@ @using DotNetElements.Core.StringDiff +@inherits MudComponentBase + @if (Diff?.OldText.HasDifferences is true || Diff?.NewText.HasDifferences is true) { -
@LabelOld → @LabelNew
+
@LabelOld