import { Box, Button, styled, useTheme } from '@mui/material'; import Typography from '@mui/material/Typography'; import ToolBreadcrumb from './ToolBreadcrumb'; import { capitalizeFirstLetter } from '../utils/string'; import Grid from '@mui/material/Grid'; import { Icon, IconifyIcon } from '@iconify/react'; import { categoriesColors } from '../config/uiConfig'; import { getToolsByCategory } from '@tools/index'; import { useEffect, useState } from 'react'; const StyledButton = styled(Button)(({ theme }) => ({ backgroundColor: 'white', '&:hover': { backgroundColor: theme.palette.primary.main, color: 'white' } })); interface ToolHeaderProps { title: string; description: string; icon?: IconifyIcon | string; type: string; } function ToolLinks() { const [examplesVisible, setExamplesVisible] = useState(false); useEffect(() => { const timeout = setTimeout(() => { const element = document.getElementById('examples'); if (element && isVisible(element)) { setExamplesVisible(true); } }, 500); return () => clearTimeout(timeout); }, []); const scrollToElement = (id: string) => { document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' }); }; function isVisible(elm: HTMLElement | null) { return !!elm; } return ( scrollToElement('tool')} > Use This Tool {examplesVisible && ( scrollToElement('examples')} > See Examples )} {/**/} {/* */} {/* Learn How to Use*/} {/* */} {/**/} ); } export default function ToolHeader({ icon, title, description, type }: ToolHeaderProps) { return ( category.type === type )!.rawTitle, link: '/categories/' + type }, { title } ]} /> {title} {description} {icon && ( )} ); }