refact: extract layout page logic

This commit is contained in:
Jean-Philippe Sirois
2020-01-25 14:04:38 -05:00
parent d62fe36475
commit 8722d15be5
8 changed files with 88 additions and 63 deletions
+22
View File
@@ -0,0 +1,22 @@
import React, { FC } from "react"
import { RouteComponentProps } from "@reach/router"
import startCase from "lodash/startCase"
import { Sidebar } from "../../components/Sidebar"
import { ColumnLayout } from "../ColumnLayout"
import { IPageContext } from "../index"
export const PageLayout: FC<IPageContext & RouteComponentProps> = ({
path,
children,
}) => {
const [, page] = path?.split("/")!
return (
<ColumnLayout
title={startCase(page)}
sidebar={Sidebar}
content={children}
/>
)
}