import { Box, Divider, Stack, TextField, useTheme } from '@mui/material'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import { Link, useNavigate, useParams } from 'react-router-dom'; import { filterTools, getToolsByCategory } from '../../tools'; import Hero from 'components/Hero'; import { capitalizeFirstLetter } from '@utils/string'; import { Icon } from '@iconify/react'; import { categoriesColors } from 'config/uiConfig'; import React, { useEffect } from 'react'; import IconButton from '@mui/material/IconButton'; import { ArrowBack } from '@mui/icons-material'; import BackButton from '@components/BackButton'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import SearchIcon from '@mui/icons-material/Search'; import { Helmet } from 'react-helmet'; export default function ToolsByCategory() { const navigate = useNavigate(); const theme = useTheme(); const mainContentRef = React.useRef(null); const { categoryName } = useParams(); const [searchTerm, setSearchTerm] = React.useState(''); const rawTitle = getToolsByCategory().find( (category) => category.type === categoryName )!.rawTitle; useEffect(() => { if (mainContentRef.current) { mainContentRef.current.scrollIntoView({ behavior: 'smooth' }); } }, []); return ( {`${rawTitle} Tools`} navigate('/')}> {`All ${rawTitle} Tools`} , sx: { borderRadius: 4, backgroundColor: 'background.paper', maxWidth: 400 } }} onChange={(event) => setSearchTerm(event.target.value)} /> {filterTools( getToolsByCategory().find(({ type }) => type === categoryName) ?.tools ?? [], searchTerm ).map((tool, index) => ( navigate('/' + tool.path)} direction={'row'} alignItems={'center'} spacing={2} padding={2} border={`1px solid ${theme.palette.background.default}`} borderRadius={2} > {tool.name} {tool.shortDescription} ))} ); }