mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 15:46:10 +08:00
502dac12aa
* docs: fix code * feat: lint * feat: prettier * feat: test * feat: review * feat: format html * feat: format html
24 lines
738 B
TypeScript
24 lines
738 B
TypeScript
import * as React from 'react';
|
|
|
|
import { ConfigContext } from '../../config-provider';
|
|
import type { RenderEmptyHandler } from '../../config-provider';
|
|
|
|
export default function useBase(
|
|
customizePrefixCls?: string,
|
|
direction?: 'ltr' | 'rtl',
|
|
): [
|
|
prefixCls: string,
|
|
cascaderPrefixCls: string,
|
|
direction?: 'ltr' | 'rtl',
|
|
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];
|
|
}
|