cherry-studio/packages/ui/src/components/base/Avatar/index.tsx
MyPrototypeWhat 99962b740c feat: add EmojiAvatar component and update component exports
- Introduced a new EmojiAvatar component for enhanced avatar functionality.
- Updated index.ts to export the new EmojiAvatar alongside existing components.
- Removed the old display/EmojiAvatar component to streamline the codebase.
- Adjusted various components to utilize the new Avatar structure and styling.
2025-09-29 17:47:17 +08:00

27 lines
831 B
TypeScript

import type { AvatarProps as HeroUIAvatarProps } from '@heroui/react'
import { Avatar as HeroUIAvatar, AvatarGroup as HeroUIAvatarGroup, cn } from '@heroui/react'
import EmojiAvatar from './EmojiAvatar'
export interface AvatarProps extends Omit<HeroUIAvatarProps, 'size'> {
size?: 'xs' | 'sm' | 'md' | 'lg'
}
const Avatar = (props: AvatarProps) => {
const { size, className = '', ...rest } = props
const isExtraSmall = size === 'xs'
const resolvedSize = isExtraSmall ? undefined : size
const mergedClassName = cn(isExtraSmall && 'w-6 h-6 text-tiny', 'shadow-lg', className)
return <HeroUIAvatar size={resolvedSize} className={mergedClassName} {...rest} />
}
Avatar.displayName = 'Avatar'
const AvatarGroup = HeroUIAvatarGroup
AvatarGroup.displayName = 'AvatarGroup'
export { Avatar, AvatarGroup, EmojiAvatar }