ant-design-blazor/components/divider/Divider.razor
Henry.zhang f9b615c2ca feat: add more demos (#197)
...for affix,back-top,breadcrumb,card,divider,typogragpy and timeline

Co-authored-by: ElderJames <shunjiey@hotmail.com>
2020-06-07 19:41:00 +08:00

66 lines
1.6 KiB
C#

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