mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 09:39:10 +08:00
6c656c85f7
* feat: add `okButtonProps` to pickers' props * doc: add okButtonProps to date, time picker documentation * test: add new test case for TimePicker
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],
|
|
);
|
|
}
|