ant-design-blazor/components/space/Space.razor.cs
James Yeung d2e9c4b247 feat(module: config-provider): support RTL (#1238)
* feat(module: config-provider): support RTL

* add rtl for each component

* fix rtl for pagination

* add rtl for overlay
2021-03-31 19:23:26 +08:00

41 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Components;
namespace AntDesign
{
public partial class Space : AntDomComponentBase
{
[Parameter]
public string Align { get; set; }
[Parameter]
public string Direction { get; set; } = "horizontal";
[Parameter]
public string Size { get; set; } = "small";
[Parameter]
public RenderFragment ChildContent { get; set; }
private bool HasAlign => Align.IsIn("start", "end", "center", "baseline");
private const string PrefixCls = "ant-space";
public void SetClass()
{
ClassMapper
.Add(PrefixCls)
.GetIf(() => $"{PrefixCls}-{Direction}", () => Direction.IsIn("horizontal", "vertical"))
.GetIf(() => $"{PrefixCls}-align-{Align}", () => HasAlign)
.If($"{PrefixCls}-align-center", () => !HasAlign && Direction == "horizontal")
.If($"{PrefixCls}-rtl", () => RTL);
}
protected override void OnInitialized()
{
SetClass();
base.OnInitialized();
}
}
}