mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 18:09:22 +08:00
22 lines
597 B
TypeScript
22 lines
597 B
TypeScript
|
import React, { useMemo } from 'react';
|
||
|
import type { Components } from 'rc-picker/lib/interface';
|
||
|
|
||
|
import type { ButtonProps } from '../../button/button';
|
||
|
import Button from '../../button/button';
|
||
|
|
||
|
export default function useComponents(components?: Components, buttonProps?: ButtonProps) {
|
||
|
function PickerButton(props: ButtonProps) {
|
||
|
const mergedProps = { size: 'small', type: 'primary', ...buttonProps, ...props } as ButtonProps;
|
||
|
|
||
|
return <Button {...mergedProps} />;
|
||
|
}
|
||
|
|
||
|
return useMemo(
|
||
|
() => ({
|
||
|
button: PickerButton,
|
||
|
...components,
|
||
|
}),
|
||
|
[components],
|
||
|
);
|
||
|
}
|