mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 17:31:42 +08:00
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Text;
|
|||
|
using Microsoft.AspNetCore.Components;
|
|||
|
|
|||
|
namespace AntDesign
|
|||
|
{
|
|||
|
public partial class Divider : AntDomComponentBase
|
|||
|
{
|
|||
|
[Parameter] public RenderFragment ChildContent { get; set; }
|
|||
|
|
|||
|
[Parameter] public string Text { get; set; }
|
|||
|
|
|||
|
[Parameter] public bool 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")
|
|||
|
.Get(() => $"ant-divider-{this.Type.ToLowerInvariant()}")
|
|||
|
.If("ant-divider-with-text", () => Text != null || ChildContent != null)
|
|||
|
.GetIf(() => $"ant-divider-with-text-{this.Orientation.ToLowerInvariant()}", () => Text != null || ChildContent != null)
|
|||
|
.If($"ant-divider-plain", () => Plain && (Text != null || ChildContent != null))
|
|||
|
.If("ant-divider-dashed", () => Dashed)
|
|||
|
;
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnInitialized()
|
|||
|
{
|
|||
|
SetClass();
|
|||
|
base.OnInitialized();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|