mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 21:59:41 +08:00
9772a63b4c
* fix: Avatar group size * fix
21 lines
589 B
TypeScript
21 lines
589 B
TypeScript
import * as React from 'react';
|
|
import { ScreenSizeMap } from '../_util/responsiveObserve';
|
|
|
|
export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
|
|
|
|
const SizeContext = React.createContext<AvatarSize>('default');
|
|
|
|
export interface SizeContextProps {
|
|
size?: AvatarSize;
|
|
}
|
|
|
|
export const SizeContextProvider: React.FC<SizeContextProps> = ({ children, size }) => (
|
|
<SizeContext.Consumer>
|
|
{originSize => (
|
|
<SizeContext.Provider value={size || originSize}>{children}</SizeContext.Provider>
|
|
)}
|
|
</SizeContext.Consumer>
|
|
);
|
|
|
|
export default SizeContext;
|