chore: smooth scroll for use this tool and examles

This commit is contained in:
Ibrahima G. Coulibaly
2025-03-08 06:19:54 +00:00
parent 6a14840e91
commit 7c64997fc7

View File

@@ -24,6 +24,9 @@ interface ToolHeaderProps {
function ToolLinks() { function ToolLinks() {
const theme = useTheme(); const theme = useTheme();
const scrollToElement = (id: string) => {
document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' });
};
return ( return (
<Grid container spacing={2} mt={1}> <Grid container spacing={2} mt={1}>
<Grid item md={12} lg={6}> <Grid item md={12} lg={6}>
@@ -31,13 +34,17 @@ function ToolLinks() {
sx={{ backgroundColor: 'white' }} sx={{ backgroundColor: 'white' }}
fullWidth fullWidth
variant="outlined" variant="outlined"
href="#tool" onClick={() => scrollToElement('tool')}
> >
Use This Tool Use This Tool
</StyledButton> </StyledButton>
</Grid> </Grid>
<Grid item md={12} lg={6}> <Grid item md={12} lg={6}>
<StyledButton fullWidth variant="outlined" href="#examples"> <StyledButton
fullWidth
variant="outlined"
onClick={() => scrollToElement('examples')}
>
See Examples See Examples
</StyledButton> </StyledButton>
</Grid> </Grid>