Init
This commit is contained in:
33
Prefab.Web.Client/Components/Shared/CardGrid.razor
Normal file
33
Prefab.Web.Client/Components/Shared/CardGrid.razor
Normal file
@@ -0,0 +1,33 @@
|
||||
<div class="@ContainerClass">
|
||||
@ChildContent
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string View { get; set; } = "grid";
|
||||
|
||||
[Parameter]
|
||||
public string CssClass { get; set; } = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment? ChildContent { get; set; }
|
||||
|
||||
private string ContainerClass => string.Join(" ", BuildClasses());
|
||||
|
||||
private IEnumerable<string> BuildClasses()
|
||||
{
|
||||
yield return "products-view__list";
|
||||
yield return "products-list";
|
||||
yield return ResolveLayoutClass();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(CssClass))
|
||||
{
|
||||
yield return CssClass;
|
||||
}
|
||||
}
|
||||
|
||||
private string ResolveLayoutClass() =>
|
||||
string.Equals(View, "list", StringComparison.OrdinalIgnoreCase)
|
||||
? "products-list--layout--list"
|
||||
: "products-list--layout--grid-3";
|
||||
}
|
||||
Reference in New Issue
Block a user