import { Autocomplete, Box, Stack, TextField } from '@mui/material'; import Typography from '@mui/material/Typography'; import SearchIcon from '@mui/icons-material/Search'; import Grid from '@mui/material/Grid'; import { useState } from 'react'; import { DefinedTool } from '@tools/defineTool'; import { filterTools, tools } from '@tools/index'; import { useNavigate } from 'react-router-dom'; import _ from 'lodash'; const exampleTools: { label: string; url: string }[] = [ { label: 'Create a transparent image', url: '/png/create-transparent' }, { label: 'Convert text to morse code', url: '/string/to-morse' }, { label: 'Change GIF speed', url: '/gif/change-speed' }, { label: 'Pick a random item', url: '' }, { label: 'Find and replace text', url: '' }, { label: 'Convert emoji to image', url: '' }, { label: 'Split a string', url: '/string/split' }, { label: 'Calculate number sum', url: '/number/sum' }, { label: 'Pixelate an image', url: '' } ]; export default function Hero() { const [inputValue, setInputValue] = useState(''); const [filteredTools, setFilteredTools] = useState( _.shuffle(tools) ); const navigate = useNavigate(); const handleInputChange = ( event: React.ChangeEvent<{}>, newInputValue: string ) => { setInputValue(newInputValue); setFilteredTools(_.shuffle(filterTools(tools, newInputValue))); }; return ( Get Things Done Quickly with{' '} Omni Tools Boost your productivity with Omni Tools, the ultimate toolkit for getting things done quickly! Access thousands of user-friendly utilities for editing images, text, lists, and data, all directly from your browser. option.name} renderInput={(params) => ( }} onChange={(event) => handleInputChange(event, event.target.value)} /> )} renderOption={(props, option) => ( navigate('/' + option.path)} > {option.name} {option.shortDescription} )} /> {exampleTools.map((tool) => ( navigate(tool.url)} item xs={12} md={6} lg={4} key={tool.label} > {tool.label} ))} ); }