Skip to content

Commit 88f8462

Browse files
authored
Stepper: Fix icon action button display bug (#171) (#173)
1 parent 94846d0 commit 88f8462

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

CodeBeam.MudBlazor.Extensions/Components/Stepper/MudStepper.razor

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,15 @@
7171

7272
@if (!DisablePreviousButton && ActiveIndex != 0)
7373
{
74-
if (ActiveIndex < Steps.Count && Steps[ActiveIndex].Status != StepStatus.Continued || showResultStep)
74+
if (IconActionButtons || MobileView)
7575
{
76-
<MudIconButton Color="@Color" Variant="@Variant" Icon="@Icons.Material.Filled.ChevronLeft" OnClick="@(() => SetActiveIndex(-1))" />
76+
<MudTooltip Text="@LocalizedStrings.Previous" Delay="300">
77+
<MudIconButton Color="@Color" Variant="@Variant" Icon="@Icons.Material.Filled.ChevronLeft" OnClick="@(() => SetActiveIndex(-1))" />
78+
</MudTooltip>
7779
}
7880
else
7981
{
80-
if (IconActionButtons || MobileView)
81-
{
82-
<MudTooltip Text="@LocalizedStrings.Previous" Delay="300">
83-
<MudIconButton Color="@Color" Variant="@Variant" Icon="@Icons.Material.Filled.ChevronLeft" OnClick="@(() => SetActiveIndex(-1))" />
84-
</MudTooltip>
85-
}
86-
else
87-
{
88-
<MudButton Color="@Color" Variant="@Variant" OnClick="@(() => SetActiveIndex(-1))">@LocalizedStrings.Previous</MudButton>
89-
}
82+
<MudButton Color="@Color" Variant="@Variant" OnClick="@(() => SetActiveIndex(-1))">@LocalizedStrings.Previous</MudButton>
9083
}
9184
}
9285

@@ -132,7 +125,16 @@
132125
{
133126
if (ActiveIndex < Steps.Count && Steps[ActiveIndex].Status != StepStatus.Continued)
134127
{
135-
<MudIconButton Color="@Color" Variant="@Variant" Icon="@Icons.Material.Filled.ChevronRight" OnClick="@(() => SetActiveIndex(1))" />
128+
if (IconActionButtons || MobileView)
129+
{
130+
<MudTooltip Text="@GetNextButtonString()" Delay="300">
131+
<MudIconButton Color="@Color" Variant="@Variant" Icon="@Icons.Material.Filled.ChevronRight" OnClick="@(() => SetActiveIndex(1))"/>
132+
</MudTooltip>
133+
}
134+
else
135+
{
136+
<MudButton Color="@Color" Variant="@Variant" OnClick="@(() => SetActiveIndex(1))">@GetNextButtonString()</MudButton>
137+
}
136138
}
137139
else
138140
{

CodeBeam.MudBlazor.Extensions/Components/Stepper/MudStepper.razor.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -381,19 +381,12 @@ protected bool IsStepActive(MudStep step)
381381

382382
protected int CompletedStepCount()
383383
{
384-
return Steps.Where(x => x.Status != Enums.StepStatus.Continued).Count();
384+
return Steps.Count(x => x.Status != StepStatus.Continued);
385385
}
386386

387387
protected string GetNextButtonString()
388388
{
389-
if (Steps.Count - 1 == CompletedStepCount())
390-
{
391-
return LocalizedStrings.Finish;
392-
}
393-
else
394-
{
395-
return LocalizedStrings.Next;
396-
}
389+
return ActiveIndex >= Steps.Count - 1 ? LocalizedStrings.Finish : LocalizedStrings.Next;
397390
}
398391

399392
protected internal bool ShowResultStep()

0 commit comments

Comments
 (0)