import React, { FC } from 'react';

import { hints } from '../constants/search-hints';

import { TokenSearchHint } from './TokenSearchHint';

type HintProps = {
    terms?: string;
};
export const TokenSearchHints: FC<HintProps> = ({ terms }) => {
    if (!terms) {
        return null;
    }
    return (
        <>
            {Object.entries(hints).map(([trigger, hint]) => {
                return (
                    terms.toLowerCase().indexOf(trigger) > -1 && (
                        <TokenSearchHint key={trigger} hint={hint} />
                    )
                );
            })}
        </>
    );
};
