'use client'; import type { UseEmojiPickerType } from '@udecode/plate-emoji/react'; export type EmojiPickerPreviewProps = Pick< UseEmojiPickerType, 'emoji' | 'hasFound' | 'i18n' | 'isSearching' >; export type EmojiPreviewProps = Pick; export type NoEmojiPreviewProps = Pick; export type PickAnEmojiPreviewProps = NoEmojiPreviewProps; function EmojiPreview({ emoji }: EmojiPreviewProps) { return (
{emoji?.skins[0].native}
{emoji?.name}
{`:${emoji?.id}:`}
); } function NoEmoji({ i18n }: NoEmojiPreviewProps) { return (
😢
{i18n.searchNoResultsTitle}
{i18n.searchNoResultsSubtitle}
); } function PickAnEmoji({ i18n }: PickAnEmojiPreviewProps) { return (
☝️
{i18n.pick}
); } export function EmojiPickerPreview({ emoji, hasFound = true, i18n, isSearching = false, ...props }: EmojiPickerPreviewProps) { const showPickEmoji = !emoji && (!isSearching || hasFound); const showNoEmoji = isSearching && !hasFound; const showPreview = emoji && !showNoEmoji && !showNoEmoji; return ( <> {showPreview && } {showPickEmoji && } {showNoEmoji && } ); }