mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-06 16:06:12 +02:00
refact: extract layout page logic
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user