48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import React from 'react'
|
|
import Helmet from 'react-helmet'
|
|
import Content from '../atoms/Content'
|
|
import styles from './Route.module.scss'
|
|
import meta from '../../data/meta.json'
|
|
|
|
const Route = ({
|
|
title,
|
|
description,
|
|
wide,
|
|
children,
|
|
className
|
|
}: {
|
|
title: string
|
|
description?: string
|
|
children: any
|
|
wide?: boolean
|
|
className?: string
|
|
}) => (
|
|
<div className={className}>
|
|
<Helmet defaultTitle={meta.title} titleTemplate={`%s - ${meta.title}`}>
|
|
{/* Strip HTML from passed title */}
|
|
<title>{title.replace(/(<([^>]+)>)/gi, '')}</title>
|
|
{description && <meta name="description" content={description} />}
|
|
</Helmet>
|
|
|
|
<Content wide={wide}>
|
|
<article>
|
|
<header className={styles.header}>
|
|
<h1 className={styles.title}>{title}</h1>
|
|
{description && (
|
|
<p
|
|
className={styles.description}
|
|
dangerouslySetInnerHTML={{
|
|
__html: description
|
|
}}
|
|
/>
|
|
)}
|
|
</header>
|
|
|
|
{children}
|
|
</article>
|
|
</Content>
|
|
</div>
|
|
)
|
|
|
|
export default Route
|