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

74 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 AntDesign
2019-12-17 14:39:23 +08:00
{
public partial class Card : 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]
public string Title { get; set; }
[Parameter]
public RenderFragment TitleTemplate { get; set; }
2019-12-17 14:39:23 +08:00
[Parameter]
public RenderFragment Extra { get; set; }
[Parameter]
public RenderFragment AntCardTab { get; set; }
internal IList<CardGrid> Grids { get; set; } = new List<CardGrid>();
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
}
}
}