Show different strings based on query length

If the query is less than 3 characters, we can prompt the user to type more. Otherwise, a result wasn't found.
This commit is contained in:
Justin Edmund 2023-08-20 05:52:53 -07:00
parent 963679ed95
commit c07fdcb25c

View file

@ -11,7 +11,7 @@ import classNames from 'classnames'
import styles from './index.module.scss'
type Props = Pick<SuggestionProps, 'items' | 'command'>
type Props = Pick<SuggestionProps, 'items' | 'command' | 'query'>
export type MentionRef = {
onKeyDown: (props: { event: KeyboardEvent }) => boolean
@ -113,7 +113,9 @@ export const MentionList = forwardRef<MentionRef, Props>(
))
) : (
<div className={styles.noResult}>
{t('search.errors.no_results_generic')}
{props.query.length < 3
? t('search.errors.type')
: t('search.errors.no_results_generic')}
</div>
)}
</div>