refacotr(module: space): Add space string constants (#4263)
* Add string constants for space size * Add align constants * Update docs
This commit is contained in:
Родитель
aea640c49b
Коммит
afeeb57631
|
@ -71,11 +71,11 @@ namespace AntDesign
|
|||
|
||||
private readonly IList<SpaceItem> _items = new List<SpaceItem>();
|
||||
|
||||
private bool HasAlign => Align.IsIn("start", "end", "center", "baseline");
|
||||
private bool HasAlign => Align.IsIn(SpaceAlign.Start, SpaceAlign.End, SpaceAlign.Center, SpaceAlign.Baseline);
|
||||
|
||||
private const string PrefixCls = "ant-space";
|
||||
|
||||
private OneOf<string, (string, string)> _size = "small";
|
||||
private OneOf<string, (string, string)> _size = SpaceSize.Small;
|
||||
|
||||
private string InnerStyle => Wrap && Direction == DirectionVHType.Horizontal ? "flex-wrap: wrap;" : "";
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace AntDesign
|
|||
|
||||
private static readonly Dictionary<string, string> _spaceSize = new()
|
||||
{
|
||||
["small"] = "8",
|
||||
["middle"] = "16",
|
||||
["large"] = "24"
|
||||
[SpaceSize.Small] = "8",
|
||||
[SpaceSize.Middle] = "16",
|
||||
[SpaceSize.Large] = "24"
|
||||
};
|
||||
|
||||
private string _marginStyle = "";
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace AntDesign
|
||||
{
|
||||
public sealed class SpaceAlign
|
||||
{
|
||||
public static readonly string Start = "start";
|
||||
public static readonly string End = "end";
|
||||
public static readonly string Center = "center";
|
||||
public static readonly string Baseline = "baseline";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace AntDesign
|
||||
{
|
||||
public sealed class SpaceSize
|
||||
{
|
||||
public static readonly string Small = "small";
|
||||
public static readonly string Middle = "middle";
|
||||
public static readonly string Large = "large";
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<div class="space-align-container">
|
||||
<div class="space-align-block">
|
||||
<Space Align="center">
|
||||
<Space Align="@SpaceAlign.Center">
|
||||
<SpaceItem>
|
||||
center
|
||||
</SpaceItem>
|
||||
|
@ -13,7 +13,7 @@
|
|||
</Space>
|
||||
</div>
|
||||
<div class="space-align-block">
|
||||
<Space Align="start">
|
||||
<Space Align="@SpaceAlign.Start">
|
||||
<SpaceItem>
|
||||
start
|
||||
</SpaceItem>
|
||||
|
@ -26,7 +26,7 @@
|
|||
</Space>
|
||||
</div>
|
||||
<div class="space-align-block">
|
||||
<Space Align="end">
|
||||
<Space Align="@SpaceAlign.End">
|
||||
<SpaceItem>
|
||||
end
|
||||
<Button Type="primary">Primary</Button>
|
||||
|
@ -37,7 +37,7 @@
|
|||
</Space>
|
||||
</div>
|
||||
<div class="space-align-block">
|
||||
<Space Align="baseline">
|
||||
<Space Align="@SpaceAlign.Baseline">
|
||||
<SpaceItem>
|
||||
baseline
|
||||
<Button Type="primary">Primary</Button>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<RadioGroup @bind-Value=@size OnChange="e=> setSize(e)" TValue="string">
|
||||
<Radio Value="@("small")">Small</Radio>
|
||||
<Radio Value="@("middle")">Middle</Radio>
|
||||
<Radio Value="@("large")">Large</Radio>
|
||||
<Radio Value="@SpaceSize.Small">Small</Radio>
|
||||
<Radio Value="@SpaceSize.Middle">Middle</Radio>
|
||||
<Radio Value="@SpaceSize.Large">Large</Radio>
|
||||
</RadioGroup>
|
||||
<br />
|
||||
<br />
|
||||
|
@ -21,7 +21,7 @@
|
|||
</Space>
|
||||
|
||||
@code {
|
||||
string size = "small";
|
||||
string size = SpaceSize.Small;
|
||||
void setSize(string value)
|
||||
{
|
||||
size = value;
|
||||
|
|
Загрузка…
Ссылка в новой задаче