import { classNames } from '../../lib/utils'; import { displayNameFromEmail } from '../../lib/utils/format'; /** Props for {@link NavUserChip}. */ interface NavUserChipProps { email?: string; /** The controls that sit after the name: theme switch, log out. */ children?: React.ReactNode; className?: string; } /** * The account chip the sidebar and the mobile menu share: a gradient avatar * with the email's first letter, the derived name and the email, then * whatever controls the caller puts beside them. * * @param {NavUserChipProps} props - Component props * @returns {React.ReactElement} The chip */ function NavUserChip({ email, children, className, }: NavUserChipProps): React.ReactElement { const name = displayNameFromEmail(email); const initial = (email?.charAt(0) ?? '?').toUpperCase(); return (