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

58 lines
1.9 KiB
TypeScript
Raw Normal View History

2024-06-26 09:02:05 +01:00
import { Box, Card, CardContent } 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
2024-06-26 00:29:53 +01:00
padding={{ xs: 1, md: 3, lg: 5 }}
2024-06-22 22:06:16 +01:00
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) => (
2024-06-26 00:29:53 +01:00
<Grid key={category.type} item xs={12} md={6}>
2024-06-25 09:35:44 +01:00
<Card>
<CardContent>
<Link
style={{ fontSize: 20 }}
to={'/categories/' + category.type}
>
{category.title}
</Link>
<Typography sx={{ mt: 2 }}>{category.description}</Typography>
2024-06-26 00:29:53 +01:00
<Grid mt={1} container spacing={2}>
<Grid item xs={12} md={6}>
<Button
fullWidth
onClick={() => navigate('/categories/' + category.type)}
variant={'contained'}
>{`See all ${category.title}`}</Button>
</Grid>
<Grid item xs={12} md={6}>
<Button
fullWidth
onClick={() => navigate(category.example.path)}
variant={'outlined'}
>{`Try ${category.example.title}`}</Button>
</Grid>
</Grid>
2024-06-25 09:35:44 +01:00
</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
}