mastodon/app/javascript/mastodon/components/display_name/no-domain.tsx
ChaosExAnima 3188a0e11e
Some checks are pending
Chromatic / Run Chromatic (push) Waiting to run
move HTML and Text components into the Emoji directory
2025-09-29 14:12:45 +02:00

45 lines
1.3 KiB
TypeScript

import type { ComponentPropsWithoutRef, FC } from 'react';
import classNames from 'classnames';
import { EmojiText } from '@/mastodon/components/emoji/text';
import { isModernEmojiEnabled } from '@/mastodon/utils/environment';
import { AnimateEmojiProvider } from '../emoji/context';
import { Skeleton } from '../skeleton';
import type { DisplayNameProps } from './index';
export const DisplayNameWithoutDomain: FC<
Omit<DisplayNameProps, 'variant' | 'localDomain'> &
ComponentPropsWithoutRef<'span'>
> = ({ account, className, children, ...props }) => {
return (
<AnimateEmojiProvider
as='span'
{...props}
className={classNames('display-name animate-parent', className)}
>
<bdi>
{account ? (
<strong className='display-name__html'>
<EmojiText
text={
isModernEmojiEnabled()
? account.get('display_name')
: account.get('display_name_html')
}
extraEmojis={account.get('emojis')}
/>
</strong>
) : (
<strong className='display-name__html'>
<Skeleton width='10ch' />
</strong>
)}
</bdi>
{children}
</AnimateEmojiProvider>
);
};