import React from 'react' import { AvatarProps } from './types' import { MobileStyleRegistry } from '../../Registry' import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles' import { AvatarContext } from './context' import { AvatarContent } from './components/Content' import { useStylesFor } from '../../hooks' import { AvatarIllustration } from './components/Illustration' import { AvatarText } from './components/Text' import { AvatarBadge } from './components/Badge' import { AvatarOverlayIcon } from './components/OverlayIcon' export * from './styles' export * from './types' export const Avatar = (props: AvatarProps) => { const { children, style, ...contextValue } = { ...Avatar.defaultProps, ...props, } const styles = useStylesFor(Avatar.styleRegistryName, style) return ( {children} ) } Avatar.styleRegistryName = 'Avatar' Avatar.elements = ['wrapper', 'text', 'image', 'icon', 'overlayIcon', 'badge'] Avatar.rootElement = 'wrapper' Avatar.Illustration = AvatarIllustration Avatar.Text = AvatarText Avatar.Badge = AvatarBadge Avatar.OverlayIcon = AvatarOverlayIcon Avatar.withVariantTypes = (styles: S) => { return Avatar as ((props: StyledComponentProps) => IJSX) & Pick } Avatar.defaultProps = { badge: false, firstNameOnly: false, } as Partial MobileStyleRegistry.registerComponent(Avatar)