Files
blitzkit/src/app/tools/layout.tsx
T

54 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-09-18 21:55:40 +00:00
'use client';
2023-09-24 17:36:20 -05:00
import { usePathname } from 'next/navigation';
2023-09-18 21:55:40 +00:00
import { ReactNode } from 'react';
2023-09-24 17:24:21 -05:00
import { TOOLS } from '../../constants/tools';
2023-09-18 21:55:40 +00:00
import { theme } from '../../stitches.config';
interface ToolsLayoutProps {
children: ReactNode;
}
export default function ToolsLayout({ children }: ToolsLayoutProps) {
2023-09-24 17:36:20 -05:00
const pathname = usePathname();
const toolId = pathname.split('/').at(-1);
2023-09-18 21:55:40 +00:00
const tool = TOOLS.find((tool) => tool.id === toolId);
return (
<>
<div
style={{
height: 128,
backgroundImage: `url(/assets/banners/${toolId}.png)`,
backgroundSize: 'cover',
backgroundPosition: 'center',
boxShadow: `inset 0 -192px 128px -128px ${theme.colors.appBackground1}`,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
gap: 4,
flexDirection: 'column',
}}
>
<span
style={{
color: theme.colors.textHighContrast,
fontSize: 32,
}}
>
{tool?.title}
</span>
<span
style={{
color: theme.colors.textLowContrast,
fontSize: 16,
}}
>
{tool?.description}
</span>
</div>
{children}
</>
);
}