mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-04 21:18:01 +08:00
9d1854763d
* refactor: add useSize * fix * fix * fix * fix * fix
19 lines
531 B
TypeScript
19 lines
531 B
TypeScript
import * as React from 'react';
|
|
import useSize from './hooks/useSize';
|
|
|
|
export type SizeType = 'small' | 'middle' | 'large' | undefined;
|
|
|
|
const SizeContext = React.createContext<SizeType>(undefined);
|
|
|
|
export interface SizeContextProps {
|
|
size?: SizeType;
|
|
children?: React.ReactNode;
|
|
}
|
|
|
|
export const SizeContextProvider: React.FC<SizeContextProps> = ({ children, size }) => {
|
|
const mergedSize = useSize(size);
|
|
return <SizeContext.Provider value={mergedSize}>{children}</SizeContext.Provider>;
|
|
};
|
|
|
|
export default SizeContext;
|