ant-design-blazor/components/divider/AntDivider.razor

62 lines
1.3 KiB
C#
Raw Normal View History

@namespace AntDesign
2019-12-18 16:57:00 +08:00
@inherits AntDomComponentBase
<span class="@ClassMapper.Class" style="@Style" id="@Id" @ref="Ref">
@if (Text != null || ChildContent != null)
2019-12-18 16:57:00 +08:00
{
<span class="ant-divider-inner-text">
@if (Text != null)
2019-12-18 16:57:00 +08:00
{
@Text
2019-12-18 16:57:00 +08:00
}
else
{
@ChildContent
}
</span>
}
</span>
@code {
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public string Text { get; set; }
2019-12-18 16:57:00 +08:00
/// <summary>
/// 'horizontal' | 'vertical'
/// </summary>
[Parameter] public string Type { get; set; } = "horizontal";
2019-12-18 16:57:00 +08:00
/// <summary>
/// 'left' | 'right' | 'center'
/// </summary>
[Parameter] public string Orientation { get; set; } = "center";
2019-12-18 16:57:00 +08:00
[Parameter] public bool Dashed { get; set; } = false;
2019-12-18 16:57:00 +08:00
private void setClass()
{
ClassMapper.Clear()
.Add("ant-divider")
.Add($"ant-divider-{this.Type}")
.If($"ant-divider-with-text-{this.Orientation}", () => Text != null || ChildContent != null)
.If("ant-divider-dashed", () => Dashed)
2019-12-18 16:57:00 +08:00
;
}
protected override void OnParametersSet()
{
setClass();
base.OnParametersSet();
}
protected override void OnInitialized()
{
setClass();
base.OnInitialized();
}
}