import { SitePathsContext } from 'Components/utils/withSitePaths' import { parentName } from 'Engine/rules.js' import { pick, sortBy, take } from 'ramda' import React, { useContext, useEffect, useState } from 'react' import Highlighter from 'react-highlight-words' import { useTranslation } from 'react-i18next' import { Link, Redirect } from 'react-router-dom' import { Rule } from 'Types/rule' import Worker from 'worker-loader!./SearchBar.worker.js' import { capitalise0 } from '../utils' const worker = new Worker() type SearchBarProps = { rules: Array showDefaultList: boolean finally?: () => void } type Option = Pick export default function SearchBar({ rules, showDefaultList, finally: finallyCallback }: SearchBarProps) { const sitePaths = useContext(SitePathsContext) const [input, setInput] = useState('') const [selectedOption, setSelectedOption] = useState