mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 05:59:34 +02:00
chore: smooth scroll for use this tool and examles
This commit is contained in:
@@ -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>
|
||||||
|
Reference in New Issue
Block a user