import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { HStack, Icon, IconButton, Input, Stack } from 'soapbox/components/ui'; import PopularGroups from './components/discover/popular-groups'; import Search from './components/discover/search/search'; import SuggestedGroups from './components/discover/suggested-groups'; import TabBar, { TabItems } from './components/tab-bar'; const messages = defineMessages({ placeholder: { id: 'groups.discover.search.placeholder', defaultMessage: 'Search' }, }); const Discover: React.FC = () => { const intl = useIntl(); const [isSearching, setIsSearching] = useState(false); const [value, setValue] = useState(''); const hasSearchValue = value && value.length > 0; const cancelSearch = () => { clearValue(); setIsSearching(false); }; const clearValue = () => setValue(''); return ( {isSearching ? ( ) : null} setValue(event.target.value)} onFocus={() => setIsSearching(true)} outerClassName='mt-0 w-full' theme='search' append={ } /> {isSearching ? ( setValue(newValue)} /> ) : ( <> )} ); }; export default Discover;