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.
17 lines
614 B
17 lines
614 B
1 year ago
|
import type { InjectionKey } from 'vue';
|
||
|
import { inject, provide } from 'vue';
|
||
|
import type { ScreenSizeMap } from '../_util/responsiveObserve';
|
||
|
export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
|
||
|
export interface AvatarContextType {
|
||
|
size?: AvatarSize;
|
||
|
shape?: 'circle' | 'square';
|
||
|
}
|
||
|
const AvatarContextKey: InjectionKey<AvatarContextType> = Symbol('AvatarContextKey');
|
||
|
|
||
|
export const useAvatarInjectContext = () => {
|
||
|
return inject(AvatarContextKey, {});
|
||
|
};
|
||
|
export const useAvatarProviderContext = (context: AvatarContextType) => {
|
||
|
return provide(AvatarContextKey, context);
|
||
|
};
|