mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
type: use DirectionType (#50117)
This commit is contained in:
parent
e8fa5938ab
commit
525e33737d
@ -1,15 +1,15 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { ConfigContext } from '../../config-provider';
|
||||
import type { RenderEmptyHandler } from '../../config-provider';
|
||||
import type { DirectionType, RenderEmptyHandler } from '../../config-provider';
|
||||
|
||||
export default function useBase(
|
||||
function useBase(
|
||||
customizePrefixCls?: string,
|
||||
direction?: 'ltr' | 'rtl',
|
||||
direction?: DirectionType,
|
||||
): [
|
||||
prefixCls: string,
|
||||
cascaderPrefixCls: string,
|
||||
direction?: 'ltr' | 'rtl',
|
||||
direction?: DirectionType,
|
||||
renderEmpty?: RenderEmptyHandler,
|
||||
] {
|
||||
const { getPrefixCls, direction: rootDirection, renderEmpty } = React.useContext(ConfigContext);
|
||||
@ -21,3 +21,5 @@ export default function useBase(
|
||||
|
||||
return [prefixCls, cascaderPrefixCls, mergedDirection, renderEmpty];
|
||||
}
|
||||
|
||||
export default useBase;
|
||||
|
@ -1,13 +1,15 @@
|
||||
import React from 'react';
|
||||
|
||||
import type { DirectionType } from '../../config-provider';
|
||||
|
||||
export const offset = 4;
|
||||
|
||||
export default function dropIndicatorRender(props: {
|
||||
function dropIndicatorRender(props: {
|
||||
dropPosition: -1 | 0 | 1;
|
||||
dropLevelOffset: number;
|
||||
indent: number;
|
||||
prefixCls: string;
|
||||
direction: 'ltr' | 'rtl';
|
||||
direction: DirectionType;
|
||||
}) {
|
||||
const { dropPosition, dropLevelOffset, prefixCls, indent, direction = 'ltr' } = props;
|
||||
const startPosition = direction === 'ltr' ? 'left' : 'right';
|
||||
@ -31,3 +33,5 @@ export default function dropIndicatorRender(props: {
|
||||
}
|
||||
return <div style={style} className={`${prefixCls}-drop-indicator`} />;
|
||||
}
|
||||
|
||||
export default dropIndicatorRender;
|
||||
|
Loading…
Reference in New Issue
Block a user