omni-tools/src/components/ToolHeader.tsx

60 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-06-23 01:35:40 -07:00
import { Button, Box, Stack } 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-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 (
<Box display="flex" gap={2} my={2}>
<Button variant="outlined" href="#tool">
Use This Tool
</Button>
<Button variant="outlined" href="#examples">
See Examples
</Button>
<Button variant="outlined" href="#tour">
Learn How to Use
</Button>
</Box>
);
}
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 }
]}
/>
<Stack direction={'row'} alignItems={'center'} spacing={2}>
<Box>
<Typography mb={2} fontSize={30} color={'primary'}>
{title}
</Typography>
<Typography fontSize={20}>{description}</Typography>
<ToolLinks />
</Box>
{image && <img width={'250'} src={image} />}
</Stack>
</Box>
2024-06-22 22:06:16 +01:00
);
2024-06-19 21:18:35 +01:00
}