import { useState, useRef, useCallback } from 'react'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import Overlay from 'react-overlays/Overlay'; import AlternateEmailIcon from '@/material-icons/400-24px/alternate_email.svg?react'; import BadgeIcon from '@/material-icons/400-24px/badge.svg?react'; import GlobeIcon from '@/material-icons/400-24px/globe.svg?react'; import { Icon } from 'mastodon/components/icon'; export const DomainPill: React.FC<{ domain: string; username: string; isSelf: boolean; }> = ({ domain, username, isSelf }) => { const [open, setOpen] = useState(false); const [expanded, setExpanded] = useState(false); const triggerRef = useRef(null); const handleClick = useCallback(() => { setOpen(!open); }, [open, setOpen]); const handleExpandClick = useCallback(() => { setExpanded(!expanded); }, [expanded, setExpanded]); return ( <> {domain} {({ props }) => ( {isSelf ? ( ) : ( )} @{username}@{domain} {isSelf ? ( ) : ( )} {isSelf ? ( ) : ( )} {isSelf ? ( ( {x} ), }} /> ) : ( ( {x} ), }} /> )} {expanded && ( <> > )} )} > ); };
{isSelf ? ( ) : ( )}
{isSelf ? ( ( {x} ), }} /> ) : ( ( {x} ), }} /> )}