In real use, here's what it could look like:
const UserIndicatorMenu = ({user, logout, translations}) => {
const {on: isMenuOpen, toggle: toggleMenu} = useToggle({});
// Decide whether the menu should be positioned left or right, depending on overflow
const menuRef = useLeftRightAutoPosition(isMenuOpen);
return (
<Box position="relative">
<button aria-expanded={isMenuOpen} onClick={toggleMenu} className={`${buttonCls} silver-40`}>
{/* Use margin+negative margin for pseudo- gap */}
<Flex mn="1" alignItems="center" flexWrap="wrap-reverse">
<Box ma="1">
<BlockText ma="0">{`${user.get('firstName')} ${user.get('lastName')}`}</BlockText>
</Box>
<img
// Hide the alt, because the name is displayed already
alt=""
src={getProfileImagePlay(user, 'tiny')}
className="db w2 ht2 br-100 ma1"
width="40"
height="40"
/>
</Flex>
</button>
<Box
display={isMenuOpen ? 'block' : 'none'}
bgColor="dark-40"
position="absolute"
shadow="1"
mt="2"
ref={menuRef}
extraClassName="top-100 z-nav-popout"
>
<ul className="pv2 vs3">
<li>
<SimpleLink
onClickInternal={toggleMenu}
className={linkCls}
href={`/players/${user.get('id')}`}
>
{translations.get('USER_INDICATOR_PROFILE_LABEL')}
</SimpleLink>
</li>
<li>
<SimpleLink onClickInternal={toggleMenu} className={linkCls} href="/change-password">
{translations.get('USER_INDICATOR_CHANGE_PASSWORD_LABEL')}
</SimpleLink>
</li>
<li>
<button className={`${buttonCls} ph3 silver-10`} onClick={logout}>
{translations.get('LOGOUT')}
</button>
</li>
</ul>
</Box>
</Box>
);
};