You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import * as React from 'react';
|
|
|
|
import type { ScreenSizeMap } from '../_util/responsiveObserver';
|
|
|
|
|
|
|
|
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 }) => {
|
|
|
|
const originSize = React.useContext<AvatarSize>(SizeContext);
|
|
|
|
return <SizeContext.Provider value={size || originSize}>{children}</SizeContext.Provider>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SizeContext;
|