mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
1719748a29
* chore: eslint add consistent-type-imports * fix avatar * Update Item.tsx
22 lines
624 B
TypeScript
22 lines
624 B
TypeScript
import * as React from 'react';
|
|
import type { ScreenSizeMap } from '../_util/responsiveObserve';
|
|
|
|
export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
|
|
|
|
const SizeContext = React.createContext<AvatarSize>('default');
|
|
|
|
export interface SizeContextProps {
|
|
size?: AvatarSize;
|
|
children?: React.ReactNode;
|
|
}
|
|
|
|
export const SizeContextProvider: React.FC<SizeContextProps> = ({ children, size }) => (
|
|
<SizeContext.Consumer>
|
|
{originSize => (
|
|
<SizeContext.Provider value={size || originSize}>{children}</SizeContext.Provider>
|
|
)}
|
|
</SizeContext.Consumer>
|
|
);
|
|
|
|
export default SizeContext;
|