Skip to content

Commit

Permalink
docs: Fix filter bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Mar 4, 2022
1 parent ec65cca commit 84bc8d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions website/src/components/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/Shortcodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { ShortcodePreset } from 'emojibase';

export interface ShortcodesProps {
preset: ShortcodePreset;
shortcodes?: string[] | string;
shortcodes?: Set<string> | 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) => (
<div key={`${preset}-${s}`}>{`:${s}:`}</div>
))}
</>
Expand Down

0 comments on commit 84bc8d2

Please sign in to comment.