omni-tools/src/pages/home/index.tsx

56 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-06-25 09:35:44 +01:00
import { Box, Card, CardContent, Stack } from '@mui/material';
2024-06-22 22:06:16 +01:00
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
2024-06-23 01:26:04 +01:00
import { Link, useNavigate } from 'react-router-dom';
2024-06-25 09:35:44 +01:00
import { getToolsByCategory } from '../../tools';
2024-06-23 01:26:04 +01:00
import Button from '@mui/material/Button';
2024-06-25 09:35:44 +01:00
import Hero from 'components/Hero';
2024-06-19 19:10:14 +01:00
export default function Home() {
2024-06-22 22:06:16 +01:00
const navigate = useNavigate();
2024-06-25 09:35:44 +01:00
2024-06-22 22:06:16 +01:00
return (
<Box
padding={5}
display={'flex'}
flexDirection={'column'}
alignItems={'center'}
justifyContent={'center'}
width={'100%'}
>
2024-06-25 09:35:44 +01:00
<Hero />
<Grid width={'80%'} container mt={2} spacing={2}>
{getToolsByCategory().map((category) => (
<Grid key={category.type} item xs={6}>
<Card>
<CardContent>
<Link
style={{ fontSize: 20 }}
to={'/categories/' + category.type}
>
{category.title}
</Link>
<Typography sx={{ mt: 2 }}>{category.description}</Typography>
<Stack
mt={2}
direction={'row'}
justifyContent={'space-between'}
>
<Button
onClick={() => navigate('/categories/' + category.type)}
variant={'contained'}
>{`See all ${category.title}`}</Button>
<Button
onClick={() => navigate(category.example.path)}
variant={'outlined'}
>{`Try ${category.example.title}`}</Button>
</Stack>
</CardContent>
</Card>
</Grid>
))}
</Grid>
2024-06-19 19:10:14 +01:00
</Box>
2024-06-22 22:06:16 +01:00
);
2024-06-19 19:10:14 +01:00
}