omni-tools/src/components/ToolHeader.tsx

74 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-06-26 09:02:05 +01:00
import { Box, Button } from '@mui/material';
2024-06-22 22:06:16 +01:00
import Typography from '@mui/material/Typography';
2024-06-25 19:45:29 +01:00
import ToolBreadcrumb from './ToolBreadcrumb';
import { capitalizeFirstLetter } from '../utils/string';
2024-06-26 00:47:21 +01:00
import Grid from '@mui/material/Grid';
2024-06-19 21:18:35 +01:00
interface ToolHeaderProps {
title: string;
description: string;
2024-06-23 01:26:04 +01:00
image?: string;
2024-06-25 19:45:29 +01:00
type: string;
2024-06-19 21:18:35 +01:00
}
2024-06-23 01:35:40 -07:00
function ToolLinks() {
return (
2024-06-26 00:47:21 +01:00
<Grid container spacing={2} mt={1}>
<Grid item md={12} lg={4}>
<Button fullWidth variant="outlined" href="#tool">
Use This Tool
</Button>
</Grid>
<Grid item md={12} lg={4}>
<Button fullWidth variant="outlined" href="#examples">
See Examples
</Button>
</Grid>
<Grid item md={12} lg={4}>
<Button fullWidth variant="outlined" href="#tour">
Learn How to Use
</Button>
</Grid>
</Grid>
2024-06-23 01:35:40 -07:00
);
}
2024-06-23 01:26:04 +01:00
export default function ToolHeader({
image,
title,
2024-06-25 19:45:29 +01:00
description,
type
2024-06-23 01:26:04 +01:00
}: ToolHeaderProps) {
2024-06-22 22:06:16 +01:00
return (
2024-06-25 19:45:29 +01:00
<Box my={4}>
<ToolBreadcrumb
items={[
{ title: 'All tools', link: '/' },
{
title: capitalizeFirstLetter(type),
link: '/categories/' + type
},
{ title }
]}
/>
2024-06-26 00:47:21 +01:00
<Grid mt={1} container spacing={2}>
<Grid item xs={12} md={8}>
2024-06-25 19:45:29 +01:00
<Typography mb={2} fontSize={30} color={'primary'}>
{title}
</Typography>
<Typography fontSize={20}>{description}</Typography>
<ToolLinks />
2024-06-26 00:47:21 +01:00
</Grid>
{image && (
<Grid item xs={12} md={4}>
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
<img width={'250'} src={image} />
</Box>
</Grid>
)}
</Grid>
2024-06-25 19:45:29 +01:00
</Box>
2024-06-22 22:06:16 +01:00
);
2024-06-19 21:18:35 +01:00
}