mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-25 00:08:27 +08:00
26 lines
763 B
TypeScript
26 lines
763 B
TypeScript
import * as React from 'react';
|
|
|
|
import { ConfigContext } from '../../config-provider';
|
|
import type { DirectionType, RenderEmptyHandler } from '../../config-provider';
|
|
|
|
function useBase(
|
|
customizePrefixCls?: string,
|
|
direction?: DirectionType,
|
|
): [
|
|
prefixCls: string,
|
|
cascaderPrefixCls: string,
|
|
direction?: DirectionType,
|
|
renderEmpty?: RenderEmptyHandler,
|
|
] {
|
|
const { getPrefixCls, direction: rootDirection, renderEmpty } = React.useContext(ConfigContext);
|
|
|
|
const mergedDirection = direction || rootDirection;
|
|
|
|
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
|
|
|
|
return [prefixCls, cascaderPrefixCls, mergedDirection, renderEmpty];
|
|
}
|
|
|
|
export default useBase;
|