global update and global fix
This commit is contained in:
28
apps/frontend/components/chat/chat-emoji-content.tsx
Normal file
28
apps/frontend/components/chat/chat-emoji-content.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
'use client';
|
||||
|
||||
import { isEmojiId } from '@/lib/emoji-catalog';
|
||||
import { emojiIdToNative, resolveNativeEmojiContent } from '@/lib/emoji-native-map';
|
||||
|
||||
export function ChatEmojiContent({ content, size = 22 }: { content?: string | null; size?: number }) {
|
||||
if (!content) return null;
|
||||
|
||||
if (isEmojiId(content)) {
|
||||
const native = emojiIdToNative(content);
|
||||
if (native) {
|
||||
return (
|
||||
<span
|
||||
className="text-[length:var(--emoji-size)] leading-none"
|
||||
style={{ ['--emoji-size' as string]: `${size + 8}px` }}
|
||||
>
|
||||
{native}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (/:([a-z0-9-]+):/.test(content)) {
|
||||
return <span className="whitespace-pre-wrap break-words">{resolveNativeEmojiContent(content)}</span>;
|
||||
}
|
||||
|
||||
return <span className="whitespace-pre-wrap break-words">{content}</span>;
|
||||
}
|
||||
Reference in New Issue
Block a user