mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
refactor: extract public methods (#44737)
This commit is contained in:
parent
4489eec5b1
commit
5b75f3f817
@ -1,11 +1,10 @@
|
||||
import type { SpaceSize } from '.';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
|
||||
export function isPresetSize(size: SpaceSize): size is SizeType {
|
||||
export function isPresetSize(size?: SizeType | string | number): size is SizeType {
|
||||
return ['small', 'middle', 'large'].includes(size as string);
|
||||
}
|
||||
|
||||
export function isValidGapNumber(size: SpaceSize): size is number {
|
||||
export function isValidGapNumber(size?: SizeType | string | number): size is number {
|
||||
if (!size) {
|
||||
// The case of size = 0 is deliberately excluded here, because the default value of the gap attribute in CSS is 0, so if the user passes 0 in, we can directly ignore it.
|
||||
return false;
|
@ -2,6 +2,7 @@ import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import toArray from 'rc-util/lib/Children/toArray';
|
||||
|
||||
import { isPresetSize, isValidGapNumber } from '../_util/gapSize';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
import Compact from './Compact';
|
||||
@ -9,7 +10,6 @@ import { SpaceContextProvider } from './context';
|
||||
import type { SpaceContextType } from './context';
|
||||
import Item from './Item';
|
||||
import useStyle from './style';
|
||||
import { isPresetSize, isValidGapNumber } from './utils';
|
||||
|
||||
export { SpaceContext } from './context';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user