// @flow import * as React from 'react'; import { isURIValid, normalizeURI } from 'lbry-redux'; import FileTile from 'component/fileTile'; import FileListSearch from 'component/fileListSearch'; import ToolTip from 'component/common/tooltip'; import Page from 'component/page'; const MODAL_ANIMATION_TIME = 250; type Props = { query: ?string, updateSearchQuery: string => void, }; class SearchPage extends React.PureComponent { constructor() { super(); this.input = null; } componentDidMount() { // Wait for the modal to animate down before focusing // without this there is an issue with scroll the page down setTimeout(() => { if (this.input) { this.input.focus(); } }, MODAL_ANIMATION_TIME); } input: ?HTMLInputElement; render() { const { query, updateSearchQuery } = this.props; return (
(this.input = input)} className="search__input" value={query} placeholder={__('Search for anything...')} onChange={event => updateSearchQuery(event.target.value)} /> {isURIValid(query) && (
{__('Exact URL')}
)}
); } } export default SearchPage;