Skip to content

Commit adc9290

Browse files
authored
More Refactoring (#379)
1 parent 8b61a45 commit adc9290

File tree

56 files changed

+373
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+373
-293
lines changed

CodeBeam.MudBlazor.Extensions.Docs/Components/ComponentCard.razor.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ namespace MudExtensions.Docs.Components
44
{
55
public partial class ComponentCard
66
{
7-
[Inject] NavigationManager NavigationManager { get; set; }
7+
[Inject] NavigationManager? NavigationManager { get; set; }
88

99
[Parameter]
10-
public string Title { get; set; }
10+
public string? Title { get; set; }
1111

1212
[Parameter]
13-
public string ComponentName { get; set; }
13+
public string? ComponentName { get; set; }
1414

1515
[Parameter]
16-
public string Description { get; set; }
16+
public string? Description { get; set; }
1717

1818
[Parameter]
19-
public RenderFragment ChildContent { get; set; }
19+
public RenderFragment? ChildContent { get; set; }
2020

2121
[Parameter]
2222
public bool ShowActionButton { get; set; } = true;
@@ -30,8 +30,8 @@ private void NavigateComponentPage()
3030
{
3131
return;
3232
}
33-
string properName = ComponentName?.Replace(" ", null);
34-
NavigationManager.NavigateTo($"/{(string.IsNullOrEmpty(properName) ? Title.ToLowerInvariant() : properName.ToLowerInvariant())}");
33+
string? properName = ComponentName?.Replace(" ", null);
34+
NavigationManager?.NavigateTo($"/{(string.IsNullOrEmpty(properName) ? Title?.ToLowerInvariant() : properName.ToLowerInvariant())}");
3535
}
3636
}
3737
}

CodeBeam.MudBlazor.Extensions.Docs/Components/DocsApiTable.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<MudTd DataLabel="Default">
1515
@if (true)
1616
{
17-
object? instance = Activator.CreateInstance(RelatedType);
17+
object? instance = Activator.CreateInstance(RelatedType ?? typeof(string));
1818
<MudText Typo="Typo.body2">@(context.GetValue(instance)?.ToString() ?? "null")</MudText>
1919
}
2020
</MudTd>

CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/ComboBox/Examples/ComboBoxExample7.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
</MudGrid>
4747

4848
@code {
49-
MudComboBox<string>? _combobox;
5049
string? _value;
5150
string? _text;
5251
IEnumerable<string>? _selectedValues;

CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/SelectExtended/Examples/SelectExtendedExample4.razor

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
<MudSelectExtended ItemCollection="_players" ValuePresenter="ValuePresenter.ItemContent" Placeholder="Template & ItemContent" Label="Select Player" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
1515
<ItemTemplate>
1616
<MudStack Class="mud-width-full" Justify="Justify.SpaceBetween">
17-
<MudText><b>@context.Value.Item1</b></MudText>
17+
<MudText><b>@context.Value?.Item1</b></MudText>
1818
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
1919
<MudStack Row="true">
2020
<MudIcon Icon="@Icons.Material.Outlined.Person" />
21-
<MudText>@(context.Value.Item3 == true ? "Retired" : "Active")</MudText>
21+
<MudText>@(context.Value?.Item3 == true ? "Retired" : "Active")</MudText>
2222
</MudStack>
23-
<MudChip Color="Color.Info" Variant="Variant.Outlined">Total Score: @context.Value.Item2</MudChip>
23+
<MudChip Color="Color.Info" Variant="Variant.Outlined">Total Score: @context.Value?.Item2</MudChip>
2424
</MudStack>
2525
</MudStack>
2626
</ItemTemplate>
@@ -31,26 +31,26 @@
3131
<MudSelectExtended ItemCollection="_players" DisableSelectedBackground="true" ValuePresenter="ValuePresenter.Chip" MultiSelection="true" Placeholder="Both Templates & MultiSelection" Label="Select Player" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
3232
<ItemTemplate>
3333
<MudStack Class="mud-width-full" Justify="Justify.SpaceBetween">
34-
<MudText><b>@context.Value.Item1</b></MudText>
34+
<MudText><b>@context.Value?.Item1</b></MudText>
3535
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
3636
<MudStack Row="true">
3737
<MudIcon Icon="@Icons.Material.Outlined.Person" />
38-
<MudText>@(context.Value.Item3 == true ? "Retired" : "Active")</MudText>
38+
<MudText>@(context.Value?.Item3 == true ? "Retired" : "Active")</MudText>
3939
</MudStack>
40-
<MudChip Color="Color.Info" Variant="Variant.Outlined">Total Score: @context.Value.Item2</MudChip>
40+
<MudChip Color="Color.Info" Variant="Variant.Outlined">Total Score: @context.Value?.Item2</MudChip>
4141
</MudStack>
4242
</MudStack>
4343
</ItemTemplate>
4444

4545
<ItemSelectedTemplate>
4646
<MudStack Class="mud-width-full" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
47-
<MudText><b>@context.Value.Item1</b></MudText>
47+
<MudText><b>@context.Value?.Item1</b></MudText>
4848
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
4949
<MudStack Row="true">
5050
<MudIcon Icon="@Icons.Material.Outlined.Person" />
5151
@*<MudText>@(context.Value.Item3 == true ? "Retired" : "Active")</MudText>*@
5252
</MudStack>
53-
<MudChip Color="Color.Info" Variant="Variant.Outlined">Total Score: @context.Value.Item2</MudChip>
53+
<MudChip Color="Color.Info" Variant="Variant.Outlined">Total Score: @context.Value?.Item2</MudChip>
5454
</MudStack>
5555
</MudStack>
5656
</ItemSelectedTemplate>
@@ -68,7 +68,7 @@
6868

6969
<ItemDisabledTemplate>
7070
<MudStack Row="true">
71-
<MudText>@context.Value.Item1</MudText>
71+
<MudText>@context.Value?.Item1</MudText>
7272
<MudText>Player is unavailable</MudText>
7373
</MudStack>
7474
</ItemDisabledTemplate>

CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/Stepper/Examples/StepperExample1.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
</MudGrid>
130130

131131
@code {
132-
MudStepper? _stepper;
132+
MudStepper? _stepper = new();
133133
MudForm? _form;
134134
MudForm? _form2;
135135
bool _checkValidationBeforeComplete = false;

CodeBeam.MudBlazor.Extensions.Docs/Pages/Index.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@
202202

203203
private bool NothingFound()
204204
{
205-
if (_extendedComponents.Select(x => x.Item1).ToList().Any(x => x.Contains(_searchString, StringComparison.CurrentCultureIgnoreCase)))
205+
if (_extendedComponents.Select(x => x.Item1).ToList().Any(x => x.Contains(_searchString ?? "", StringComparison.CurrentCultureIgnoreCase)))
206206
{
207207
return false;
208208
}
209209

210-
if (_uniqueComponents.Select(x => x.Item1).ToList().Any(x => x.Contains(_searchString, StringComparison.CurrentCultureIgnoreCase)))
210+
if (_uniqueComponents.Select(x => x.Item1).ToList().Any(x => x.Contains(_searchString ?? "", StringComparison.CurrentCultureIgnoreCase)))
211211
{
212212
return false;
213213
}

CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/Combobox/ComboBoxTest1.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
<MudComboBoxItem Value="@("4")" Disabled="true"/>
99
</MudComboBox>
1010

11-
<MudSwitch @bind-Checked="@_focused" />
11+
<MudSwitch @bind-Value="@_focused" />
1212

1313
@code {
1414

15-
string value = null;
15+
string? value = null;
1616
bool _focused = false;
1717

1818
private void Focused()

CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/SelectExtended/MultiSelectCustomizedTextTest.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040

4141
private class TestItem
4242
{
43-
public string A { get; set; }
43+
public string? A { get; set; }
4444
}
4545
}

CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/SelectExtended/MultiSelectTest4.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
</MudGrid>
2020

2121
@code {
22-
private string value { get; set; } = "Nothing selected";
23-
private IEnumerable<string> options { get; set; }
22+
private string? value { get; set; } = "Nothing selected";
23+
private IEnumerable<string>? options { get; set; }
2424

2525
private string[] felines =
2626
{

CodeBeam.MudBlazor.Extensions.UnitTests.Viewer/TestComponents/SelectExtended/MultiSelectTest5.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"Programista", "test"
1919
};
2020

21-
private HashSet<string> _posts;
21+
private HashSet<string> _posts = new();
2222

2323
protected override void OnInitialized()
2424
{

0 commit comments

Comments
 (0)