Skip to content

Commit 47abbc2

Browse files
authored
MudLoading Text initialize (#36)
1 parent e9da78b commit 47abbc2

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

CodeBeam.MudExtensions/Components/Loading/MudLoading.razor

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
else
1414
{
1515
<MudOverlay Visible="_loading" Absolute="true" DarkBackground="@Darken">
16-
<div class="d-flex align-center justify-center">
16+
<div class="d-flex flex-column align-center justify-center">
1717
<MudProgressCircular Color="Color.Primary" Indeterminate="true" />
18+
<MudText Class="@TextClassname">@Text</MudText>
1819
</div>
1920
</MudOverlay>
2021
}
@@ -27,7 +28,10 @@
2728
}
2829
else
2930
{
31+
3032
<MudProgressLinear Class="mb-2" Color="Color.Primary" Indeterminate="true" />
33+
<MudText Class="@TextClassname" Align="Align.Center">@Text</MudText>
34+
3135
<MudOverlay Visible="_loading" Absolute="true" DarkBackground="@Darken">
3236
<div class="d-flex align-center justify-center">
3337

CodeBeam.MudExtensions/Components/Loading/MudLoading.razor.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace MudExtensions
1010
public partial class MudLoading : MudComponentBase
1111
{
1212

13+
protected string TextClassname => new CssBuilder()
14+
.AddClass("mt-4")
15+
.AddClass(ClassText)
16+
.Build();
17+
1318
bool _loading = true;
1419
/// <summary>
1520
/// Two way binded loading state.
@@ -43,6 +48,20 @@ public bool Loading
4348
[Category(CategoryTypes.FormComponent.Appearance)]
4449
public bool Overlap { get; set; } = false;
4550

51+
/// <summary>
52+
/// The text shows after the loading indicator.
53+
/// </summary>
54+
[Parameter]
55+
[Category(CategoryTypes.FormComponent.Appearance)]
56+
public string Text { get; set; }
57+
58+
/// <summary>
59+
/// CSS classes for the text, seperated by space.
60+
/// </summary>
61+
[Parameter]
62+
[Category(CategoryTypes.FormComponent.Appearance)]
63+
public string ClassText { get; set; }
64+
4665
/// <summary>
4766
/// If true, show a darken background.
4867
/// </summary>

ComponentViewer/Pages/Components/LoadingPage.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<MudGrid>
88
<MudItem xs="12" sm="8" Class="d-flex gap-4 align-center flex-wrap">
99
<MudPaper Class="mud-width-full" Style="height: 300px; position: relative">
10-
<MudLoading @bind-Loading="_loading" Overlap="@_overlap" LoaderType="_loaderType" Darken="_darken">
10+
<MudLoading @bind-Loading="_loading" Overlap="@_overlap" LoaderType="_loaderType" Darken="_darken" Text="@_text" ClassText="@(_darken ? "white-text" : null)">
1111
<MudStack>
1212
<MudText>This is a text inside a paper. Its the content.</MudText>
1313
<MudButton OnClick="ShowSnackbar" Variant="Variant.Filled" Color="Color.Primary">A Button Can Not Be Clickable While Loading</MudButton>
@@ -25,6 +25,7 @@
2525
<MudSelectItem Value="LoaderType.Circular">Circular</MudSelectItem>
2626
<MudSelectItem Value="LoaderType.Linear">Linear</MudSelectItem>
2727
</MudSelect>
28+
<MudTextField @bind-Value="_text" Variant="Variant.Outlined" Label="Text" />
2829
</MudStack>
2930
</MudItem>
3031
</MudGrid>
@@ -69,6 +70,7 @@
6970
bool _loading = true;
7071
bool _overlap;
7172
bool _darken;
73+
string _text;
7274
LoaderType _loaderType = LoaderType.Circular;
7375

7476
bool _loading2 = true;

0 commit comments

Comments
 (0)