mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-19 03:54:28 +08:00
19 lines
578 B
TypeScript
19 lines
578 B
TypeScript
|
import { useMemo } from 'react';
|
||
|
|
||
|
import type { PaginationProps } from '.';
|
||
|
import type { SelectProps } from '../select';
|
||
|
|
||
|
export default function useShowSizeChanger(showSizeChanger?: PaginationProps['showSizeChanger']) {
|
||
|
return useMemo<[show: boolean | undefined, selectProps: SelectProps | undefined]>(() => {
|
||
|
if (typeof showSizeChanger === 'boolean') {
|
||
|
return [showSizeChanger, {}];
|
||
|
}
|
||
|
|
||
|
if (showSizeChanger && typeof showSizeChanger === 'object') {
|
||
|
return [true, showSizeChanger];
|
||
|
}
|
||
|
|
||
|
return [undefined, undefined];
|
||
|
}, [showSizeChanger]);
|
||
|
}
|