diff --git a/website/src/components/Filters.tsx b/website/src/components/Filters.tsx index d42e4445..0f96e367 100644 --- a/website/src/components/Filters.tsx +++ b/website/src/components/Filters.tsx @@ -88,9 +88,9 @@ export function processEmojis( if (filter) { const matchesAnnotation = emoji.label.toLocaleLowerCase().includes(filter); const matchesAnyShortcodes = emoji.shortcodes?.some((shortcode) => - shortcode.toLocaleLowerCase().includes(filter), + shortcode?.toLocaleLowerCase().includes(filter), ); - const matchesAnyTags = emoji.tags?.some((tag) => tag.toLocaleLowerCase().includes(filter)); + const matchesAnyTags = emoji.tags?.some((tag) => tag?.toLocaleLowerCase().includes(filter)); if (!matchesAnnotation && !matchesAnyShortcodes && !matchesAnyTags) { return; diff --git a/website/src/components/Shortcodes.tsx b/website/src/components/Shortcodes.tsx index 9a8cc28f..9830dde4 100644 --- a/website/src/components/Shortcodes.tsx +++ b/website/src/components/Shortcodes.tsx @@ -3,17 +3,17 @@ import { ShortcodePreset } from 'emojibase'; export interface ShortcodesProps { preset: ShortcodePreset; - shortcodes?: string[] | string; + shortcodes?: Set | string[] | string; } export default function Shortcodes({ preset, shortcodes }: ShortcodesProps) { - if (!shortcodes || shortcodes.length === 0) { + if (!shortcodes) { return null; } return ( <> - {(Array.isArray(shortcodes) ? shortcodes : [shortcodes]).sort().map((s) => ( + {(typeof shortcodes === 'string' ? [shortcodes] : [...shortcodes]).sort().map((s) => (
{`:${s}:`}
))}