Skip to content

Commit

Permalink
Fixed unchanged background of DiffViewers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix-CodingClimber committed Apr 2, 2024
1 parent a121158 commit 2cea080
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</MudCardHeader>
<MudCardContent>
<MudPaper>
<CompactDiffViewer Diff="compactDiff" LabelOld="Old Text" LabelNew="New Text"/>
<CompactDiffViewer Diff="compactDiff" LabelOld="Old Text" LabelNew="New Text" />
</MudPaper>
</MudCardContent>
</MudCard>
Expand All @@ -38,15 +38,15 @@
private SideBySideDiffModel? sideBySideDiff;

private string? textA =
@"unchanged 1
@"unchanged 1
unchanged 2
Huhu 1
test abc test1 abc
deleted
here is a unchanged line";

private string? textB =
@"unchanged 1
@"unchanged 1
unchanged 2
Huhu 2
blub abc test2 abc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@using DotNetElements.Core.StringDiff

@inherits MudComponentBase

@if (Diff?.HasDifferences is true)
{
<table cellpadding="0" cellspacing="0" style="font-family: monospace, monospace; line-height: 1.5rem;">
<table cellpadding="0" cellspacing="0" class="@Class" style="background-color: var(@DnePalette.DiffLineUnchanged); font-family: monospace, monospace; line-height: 1.5rem; @Style">

<tr>
<th colspan="3" align="left" style="padding-left: 10px; border-bottom: 1px solid var(--mud-palette-table-lines)">@LabelOld &rarr; @LabelNew</th>
Expand Down Expand Up @@ -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})";
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@using DotNetElements.Core.StringDiff

@inherits MudComponentBase

@if (Diff?.OldText.HasDifferences is true || Diff?.NewText.HasDifferences is true)
{
<table cellpadding="0" cellspacing="0" style="font-family: monospace, monospace; line-height: 1.5rem;">
<table cellpadding="0" cellspacing="0" class="@Class" style="background-color: var(@DnePalette.DiffLineUnchanged); font-family: monospace, monospace; line-height: 1.5rem; @Style">

<tr>
<th colspan="3" align="left" style="padding-left: 10px; border-bottom: 1px solid var(--mud-palette-table-lines)">@LabelOld</th>
Expand Down

0 comments on commit 2cea080

Please sign in to comment.