mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-28 02:20:47 +00:00
24 lines
678 B
TypeScript
24 lines
678 B
TypeScript
import type { ComponentPropsWithoutRef, FC } from 'react';
|
|
|
|
import { EmojiHTML } from '@/mastodon/features/emoji/emoji_html';
|
|
import { isModernEmojiEnabled } from '@/mastodon/utils/environment';
|
|
|
|
import type { DisplayNameProps } from './index';
|
|
|
|
export const DisplayNameSimple: FC<
|
|
Omit<DisplayNameProps, 'variant' | 'localDomain'> &
|
|
ComponentPropsWithoutRef<'span'>
|
|
> = ({ account, ...props }) => {
|
|
if (!account) {
|
|
return null;
|
|
}
|
|
const accountName = isModernEmojiEnabled()
|
|
? account.get('display_name')
|
|
: account.get('display_name_html');
|
|
return (
|
|
<bdi>
|
|
<EmojiHTML {...props} htmlString={accountName} shallow as='span' />
|
|
</bdi>
|
|
);
|
|
};
|