ant-design-blazor/components/card/AntCard.razor.cs

71 lines
1.9 KiB
C#
Raw Normal View History

2019-12-17 14:39:23 +08:00
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
2020-05-16 23:27:40 +08:00
using OneOf;
2019-12-17 14:39:23 +08:00
namespace AntBlazor
{
public partial class AntCard : AntDomComponentBase
2019-12-17 14:39:23 +08:00
{
2019-12-17 17:53:25 +08:00
[Parameter]
public RenderFragment ChildContent { get; set; }
2019-12-17 14:39:23 +08:00
[Parameter]
public RenderFragment Body { get; set; }
[Parameter]
public bool Bordered { get; set; } = false;
2019-12-17 14:39:23 +08:00
[Parameter]
public bool Hoverable { get; set; } = false;
2019-12-17 14:39:23 +08:00
[Parameter]
public bool Loading { get; set; } = false;
2019-12-17 14:39:23 +08:00
[Parameter]
public string BodyStyle { get; set; }
2019-12-17 14:39:23 +08:00
[Parameter]
public RenderFragment Cover { get; set; }
[Parameter]
public IList<RenderFragment> Actions { get; set; } = new List<RenderFragment>();
[Parameter]
public string Type { get; set; }
2019-12-17 14:39:23 +08:00
[Parameter]
public string Size { get; set; }
2019-12-17 14:39:23 +08:00
[Parameter]
2020-05-16 23:27:40 +08:00
public OneOf<string, RenderFragment> Title { get; set; }
2019-12-17 14:39:23 +08:00
[Parameter]
public RenderFragment Extra { get; set; }
[Parameter]
public RenderFragment AntCardTab { get; set; }
internal IList<AntCardGrid> Grids { get; set; } = new List<AntCardGrid>();
2019-12-17 14:39:23 +08:00
protected void SetClassMap()
2019-12-17 14:39:23 +08:00
{
this.ClassMapper.Clear()
.Add("ant-card")
.If("ant-card-loading", () => Loading)
.If("ant-card-bordered", () => Bordered)
.If("ant-card-hoverable", () => Hoverable)
.If("ant-card-small", () => Size == "small")
.If("ant-card-contain-grid", () => Grids.Count > 0)
.If("ant-card-type-inner", () => Type == "inner")
2019-12-17 14:39:23 +08:00
.If("ant-card-contain-tabs", () => AntCardTab != null)
;
}
protected override void OnInitialized()
{
base.OnInitialized();
SetClassMap();
2019-12-17 14:39:23 +08:00
}
}
}