Improve home page layout
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
@using Microsoft.AspNetCore.Components
|
||||
|
||||
<MudItem xs="12" sm="6" md="3">
|
||||
<MudCard Elevation="4" Class="pa-4" Style="cursor: pointer; height: 100%;" @onclick="HandleClick">
|
||||
<MudCardContent>
|
||||
<div class="d-flex align-center mb-2">
|
||||
<MudIcon Icon="@Icon" Size="Size.Large" Class="mr-2" />
|
||||
<MudText Typo="Typo.h5">@Title</MudText>
|
||||
</div>
|
||||
<MudDivider Class="mb-3" />
|
||||
@if (Count != null)
|
||||
{
|
||||
<MudText Typo="Typo.h3" Color="Color.Info">@Count</MudText>
|
||||
<MudText Typo="Typo.body2">@Subtitle</MudText>
|
||||
}
|
||||
@if (ChildContent != null)
|
||||
{
|
||||
@ChildContent
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(Caption))
|
||||
{
|
||||
<MudText Typo="Typo.caption" Class="mt-2">@Caption</MudText>
|
||||
}
|
||||
</MudCardContent>
|
||||
</MudCard>
|
||||
</MudItem>
|
||||
|
||||
@code {
|
||||
[Parameter] public string Icon { get; set; } = string.Empty;
|
||||
[Parameter] public string Title { get; set; } = string.Empty;
|
||||
[Parameter] public int? Count { get; set; }
|
||||
[Parameter] public string? Subtitle { get; set; } = string.Empty;
|
||||
[Parameter] public string? Caption { get; set; }
|
||||
[Parameter] public RenderFragment? ChildContent { get; set; }
|
||||
[Parameter] public string NavigateUrl { get; set; } = string.Empty;
|
||||
[Inject] private NavigationManager Navigation { get; set; } = default!;
|
||||
|
||||
private void HandleClick()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(NavigateUrl))
|
||||
{
|
||||
Navigation.NavigateTo(NavigateUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user