import { as, Badge, Box, color, ContainerColor, MainColor, Text, Tooltip, TooltipProvider, toRem, } from 'folds'; import React, { ReactNode, useId } from 'react'; import * as css from './styles.css'; import { Presence, usePresenceLabel } from '../../hooks/useUserPresence'; const PresenceToColor: Record = { [Presence.Online]: 'Success', [Presence.Unavailable]: 'Warning', [Presence.Offline]: 'Secondary', }; type PresenceBadgeProps = { presence: Presence; status?: string; size?: '200' | '300' | '400' | '500'; }; export function PresenceBadge({ presence, status, size }: PresenceBadgeProps) { const label = usePresenceLabel(); const badgeLabelId = useId(); return ( {label[presence]} {status && } {status && {status}} } > {(triggerRef) => ( )} ); } type AvatarPresenceProps = { badge: ReactNode; variant?: ContainerColor; }; export const AvatarPresence = as<'div', AvatarPresenceProps>( ({ as: AsAvatarPresence, badge, variant = 'Surface', children, ...props }, ref) => ( {badge && (
{badge}
)} {children}
) );