diff --git a/components/space/Space.razor.cs b/components/space/Space.razor.cs index ef48e560c..5f6078203 100644 --- a/components/space/Space.razor.cs +++ b/components/space/Space.razor.cs @@ -71,11 +71,11 @@ namespace AntDesign private readonly IList _items = new List(); - 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 _size = "small"; + private OneOf _size = SpaceSize.Small; private string InnerStyle => Wrap && Direction == DirectionVHType.Horizontal ? "flex-wrap: wrap;" : ""; diff --git a/components/space/SpaceItem.razor.cs b/components/space/SpaceItem.razor.cs index c2e3c9eae..a0640c2c1 100644 --- a/components/space/SpaceItem.razor.cs +++ b/components/space/SpaceItem.razor.cs @@ -23,9 +23,9 @@ namespace AntDesign private static readonly Dictionary _spaceSize = new() { - ["small"] = "8", - ["middle"] = "16", - ["large"] = "24" + [SpaceSize.Small] = "8", + [SpaceSize.Middle] = "16", + [SpaceSize.Large] = "24" }; private string _marginStyle = ""; diff --git a/components/space/types/SpaceAlign.cs b/components/space/types/SpaceAlign.cs new file mode 100644 index 000000000..d445aaee7 --- /dev/null +++ b/components/space/types/SpaceAlign.cs @@ -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"; + } +} diff --git a/components/space/types/SpaceSize.cs b/components/space/types/SpaceSize.cs new file mode 100644 index 000000000..9fc651c6b --- /dev/null +++ b/components/space/types/SpaceSize.cs @@ -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"; + } +} diff --git a/site/AntDesign.Docs/Demos/Components/Space/demo/Align.razor b/site/AntDesign.Docs/Demos/Components/Space/demo/Align.razor index 6617389bf..4e362fd66 100644 --- a/site/AntDesign.Docs/Demos/Components/Space/demo/Align.razor +++ b/site/AntDesign.Docs/Demos/Components/Space/demo/Align.razor @@ -1,6 +1,6 @@ 
- + center @@ -13,7 +13,7 @@
- + start @@ -26,7 +26,7 @@
- + end @@ -37,7 +37,7 @@
- + baseline diff --git a/site/AntDesign.Docs/Demos/Components/Space/demo/Size.razor b/site/AntDesign.Docs/Demos/Components/Space/demo/Size.razor index c10269ff4..796a81c08 100644 --- a/site/AntDesign.Docs/Demos/Components/Space/demo/Size.razor +++ b/site/AntDesign.Docs/Demos/Components/Space/demo/Size.razor @@ -1,7 +1,7 @@  - Small - Middle - Large + Small + Middle + Large

@@ -21,7 +21,7 @@
@code { - string size = "small"; + string size = SpaceSize.Small; void setSize(string value) { size = value;