Skip to content

Commit 5aabbe7

Browse files
authored
Code quality improvements (#110)
1 parent 72c315b commit 5aabbe7

39 files changed

+176
-176
lines changed

CodeBeam.MudExtensions.UnitTests.Viewer/TestComponents/ListExtended/ListExperimentalCountTest.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<MudListItemExtended T="int?" Value="1" Text="Trash" />
66
<MudListItemExtended T="int?" Value="2" Text="Spam" />
77
<MudDivider />
8-
<MudListItemExtended T="int?" Value="3" Text="Inbox" Icon="@Icons.Filled.Inbox" />
9-
<MudListItemExtended T="int?" Value="4" Text="Sent" Icon="@Icons.Filled.Send" />
8+
<MudListItemExtended T="int?" Value="3" Text="Inbox" Icon="@Icons.Material.Filled.Inbox" />
9+
<MudListItemExtended T="int?" Value="4" Text="Sent" Icon="@Icons.Material.Filled.Send" />
1010
<MudDivider />
11-
<MudListItemExtended T="int?" Value="5" Avatar="@Icons.Filled.Image" IconColor="Color.Primary">Photos</MudListItemExtended>
12-
<MudListItemExtended T="int?" Value="6" Avatar="@Icons.Filled.Work" IconColor="Color.Secondary">Work</MudListItemExtended>
11+
<MudListItemExtended T="int?" Value="5" Avatar="@Icons.Material.Filled.Image" IconColor="Color.Primary">Photos</MudListItemExtended>
12+
<MudListItemExtended T="int?" Value="6" Avatar="@Icons.Material.Filled.Work" IconColor="Color.Secondary">Work</MudListItemExtended>
1313
</MudListExtended>
1414
</MudPaper>
1515

CodeBeam.MudExtensions.UnitTests/Components/SelectExtendedTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ public void MultiSelect_SelectAll2()
656656

657657
// get the first (select all item) and check if it is indeterminate
658658
var selectAllItem = comp.FindComponent<MudListItemExtended<string>>();
659-
selectAllItem.Instance.Icon.Should().Be(Icons.Filled.IndeterminateCheckBox);
659+
selectAllItem.Instance.Icon.Should().Be(Icons.Material.Filled.IndeterminateCheckBox);
660660

661661
// Check that all normal select items are actually selected
662662
//var items = comp.FindComponents<MudSelectItem<string>>().Where(x=>x.Instance.HideContent==false).ToArray();

CodeBeam.MudExtensions.UnitTests/Mocks/MockEventListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public Task<Guid> SubscribeGlobal<T>(string eventName, int throotleInterval, Fun
5959
public Task<bool> Unsubscribe(Guid key)
6060
{
6161
var result = Callbacks.ContainsKey(key);
62-
if (result == true)
62+
if (result)
6363
{
6464
Callbacks.Remove(key);
6565
ElementIdMapper.Remove(key);

CodeBeam.MudExtensions.UnitTests/Mocks/MockResizeObserver.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void UpdateTotalPanelSize(double newSize)
3939
{
4040
var entry = _cachedValues.Last();
4141

42-
if (IsVertical == false)
42+
if (!IsVertical)
4343
{
4444
entry.Value.Width = newSize;
4545
}
@@ -57,7 +57,7 @@ public void UpdatePanelSize(int index, double newSize)
5757
{
5858
var entry = _cachedValues.ElementAt(index);
5959

60-
if (IsVertical == false)
60+
if (!IsVertical)
6161
{
6262
entry.Value.Width = newSize;
6363
}
@@ -85,12 +85,12 @@ public Task<IEnumerable<BoundingClientRect>> Observe(IEnumerable<ElementReferenc
8585
{
8686
var size = PanelSize;
8787
// last element is always TabsContentSize
88-
if (item.Id == elements.Last().Id && _firstBatchProcessed == false)
88+
if (item.Id == elements.Last().Id && !_firstBatchProcessed)
8989
{
9090
size = PanelTotalSize;
9191
}
9292
var rect = new BoundingClientRect { Width = size };
93-
if (IsVertical == true)
93+
if (IsVertical)
9494
{
9595
rect = new BoundingClientRect { Height = size };
9696
}
@@ -115,7 +115,7 @@ public ValueTask DisposeAsync()
115115

116116
public BoundingClientRect GetSizeInfo(ElementReference reference)
117117
{
118-
if (_cachedValues.ContainsKey(reference) == false)
118+
if (!_cachedValues.ContainsKey(reference))
119119
{
120120
return null;
121121
}

CodeBeam.MudExtensions/Components/CsvMapper/MudCsvMapper.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@
149149
}
150150
@if (!_importedComplete)
151151
{
152-
<MudButton Class="my-2" Color="Color.Primary" StartIcon="@Icons.Filled.CloudDownload" Variant="Variant.Filled" OnClick="@OnImport" Disabled="!_valid">@LocalizedStrings.Import</MudButton>
152+
<MudButton Class="my-2" Color="Color.Primary" StartIcon="@Icons.Material.Filled.CloudDownload" Variant="Variant.Filled" OnClick="@OnImport" Disabled="!_valid">@LocalizedStrings.Import</MudButton>
153153
}
154154
else
155155
{
156-
<MudButton Class="my-2" Color="Color.Secondary" StartIcon="@Icons.Filled.RestartAlt" Variant="Variant.Filled" OnClick="@ReloadPage" Disabled="!_valid">Reset</MudButton>
156+
<MudButton Class="my-2" Color="Color.Secondary" StartIcon="@Icons.Material.Filled.RestartAlt" Variant="Variant.Filled" OnClick="@ReloadPage" Disabled="!_valid">Reset</MudButton>
157157
}
158158
</div>

CodeBeam.MudExtensions/Components/DateWheelPicker/MudDateWheelPicker.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
<div class="d-flex">
2323
@if (SubmitOnClose == false)
2424
{
25-
<MudIconButton Icon="@Icons.Filled.Done" Color="@Color" OnClick="@(() => CloseMenu(true))" />
25+
<MudIconButton Icon="@Icons.Material.Filled.Done" Color="@Color" OnClick="@(() => CloseMenu(true))" />
2626
}
2727
<MudSpacer />
2828
@if (ShowToolbar)
2929
{
30-
<MudIconButton Icon="@Icons.Filled.Sync" Color="@Color" Disabled="@(DateView == DateView.Both)" OnClick="@(() => ToggleDateView())" />
31-
<MudIconButton Icon="@(DateView == DateView.Both ? Icons.Filled.ChevronLeft : Icons.Filled.ChevronRight)" Color="@Color" OnClick="@(() => ExpandDateView())" />
30+
<MudIconButton Icon="@Icons.Material.Filled.Sync" Color="@Color" Disabled="@(DateView == DateView.Both)" OnClick="@(() => ToggleDateView())" />
31+
<MudIconButton Icon="@(DateView == DateView.Both ? Icons.Material.Filled.ChevronLeft : Icons.Material.Filled.ChevronRight)" Color="@Color" OnClick="@(() => ExpandDateView())" />
3232
}
3333
</div>
3434
}

CodeBeam.MudExtensions/Components/DateWheelPicker/MudDateWheelPicker.razor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected override void OnInitialized()
1919
Converter = new MudBlazor.Converter<DateTime?, string>()
2020
{
2121
SetFunc = x => x?.ToString(DateFormat),
22-
GetFunc = x => DateTime.TryParseExact(x, DateFormat, null, System.Globalization.DateTimeStyles.None, out dt) == true ? dt : null,
22+
GetFunc = x => DateTime.TryParseExact(x, DateFormat, null, System.Globalization.DateTimeStyles.None, out dt) ? dt : null,
2323
};
2424
}
2525

@@ -189,7 +189,7 @@ protected override void OnInitialized()
189189
public int MaxHeight { get; set; } = 300;
190190

191191
internal bool _isOpen;
192-
internal string _currentIcon { get; set; } = Icons.Filled.CalendarMonth;
192+
internal string _currentIcon { get; set; } = Icons.Material.Filled.CalendarMonth;
193193

194194
[Parameter]
195195
[Category(CategoryTypes.FormComponent.ListAppearance)]
@@ -243,7 +243,7 @@ public async Task OpenMenu()
243243
return;
244244
SetWheelValues();
245245
_isOpen = true;
246-
if (Editable == true)
246+
if (Editable)
247247
{
248248
await InputReference.FocusAsync();
249249
}

CodeBeam.MudExtensions/Components/Gallery/MudGallery.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected async Task SetAdjacentImage(int count)
111111
return;
112112
}
113113

114-
if (EnableAnimation == true)
114+
if (EnableAnimation)
115115
{
116116
await _animate.Refresh();
117117
}

CodeBeam.MudExtensions/Components/InputExtended/MudInputCssHelperExtended.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static string GetClassname<T>(MudBaseInputExtended<T> baseInput, Func<boo
1111
new CssBuilder("mud-input")
1212
.AddClass($"mud-input-{baseInput.Variant.ToDescriptionString()}")
1313
.AddClass($"mud-input-margin-{baseInput.Margin.ToDescriptionString()}", when: () => baseInput.Margin != Margin.None)
14-
.AddClass("mud-input-underline", when: () => baseInput.DisableUnderLine == false && baseInput.Variant != Variant.Outlined)
14+
.AddClass("mud-input-underline", when: () => !baseInput.DisableUnderLine && baseInput.Variant != Variant.Outlined)
1515
.AddClass("mud-shrink", when: shrinkWhen)
1616
.AddClass("mud-disabled", baseInput.Disabled)
1717
.AddClass("mud-input-error", baseInput.HasErrors)

CodeBeam.MudExtensions/Components/InputExtended/MudInputExtended.razor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ public partial class MudInputExtended<T> : MudBaseInputExtended<T>
3636

3737
protected string ClearButtonClassname =>
3838
new CssBuilder()
39-
.AddClass("me-n1", Adornment == Adornment.End && HideSpinButtons == false)
40-
.AddClass("mud-icon-button-edge-end", Adornment == Adornment.End && HideSpinButtons == true)
41-
.AddClass("me-6", Adornment != Adornment.End && HideSpinButtons == false)
42-
.AddClass("mud-icon-button-edge-margin-end", Adornment != Adornment.End && HideSpinButtons == true)
39+
.AddClass("me-n1", Adornment == Adornment.End && !HideSpinButtons)
40+
.AddClass("mud-icon-button-edge-end", Adornment == Adornment.End && HideSpinButtons)
41+
.AddClass("me-6", Adornment != Adornment.End && !HideSpinButtons)
42+
.AddClass("mud-icon-button-edge-margin-end", Adornment != Adornment.End && HideSpinButtons)
4343
.Build();
4444

4545
protected override async Task OnAfterRenderAsync(bool firstRender)
4646
{
4747
await base.OnAfterRenderAsync(firstRender);
4848
if (firstRender)
4949
{
50-
if (AutoSize == true)
50+
if (AutoSize)
5151
{
5252
await JSRuntime.InvokeVoidAsync("auto_size", ElementReference);
5353
StateHasChanged();

0 commit comments

Comments
 (0)