import clsx from 'clsx'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { fetchAliasesSuggestions, clearAliasesSuggestions, changeAliasesSuggestions } from 'soapbox/actions/aliases'; import Icon from 'soapbox/components/icon'; import { Button } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; const messages = defineMessages({ search: { id: 'aliases.search', defaultMessage: 'Search your old account' }, searchTitle: { id: 'tabs_bar.search', defaultMessage: 'Search' }, }); const Search: React.FC = () => { const dispatch = useAppDispatch(); const intl = useIntl(); const value = useAppSelector(state => state.aliases.suggestions.value); const handleChange = (e: React.ChangeEvent) => { dispatch(changeAliasesSuggestions(e.target.value)); }; const handleKeyUp = (e: React.KeyboardEvent) => { if (e.keyCode === 13) { dispatch(fetchAliasesSuggestions(value)); } }; const handleSubmit = () => { dispatch(fetchAliasesSuggestions(value)); }; const handleClear = () => { dispatch(clearAliasesSuggestions()); }; const hasValue = value.length > 0; return (
); }; export default Search;