mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-06 16:06:12 +02:00
feat: move about & rules pages to the sidebar layout
This commit is contained in:
committed by
Jean-Philippe Sirois
parent
d0eb85b61a
commit
724ef13186
@@ -1,20 +1,20 @@
|
||||
import { RouteComponentProps } from "@reach/router"
|
||||
import React, { FC, Fragment, useEffect } from "react"
|
||||
|
||||
import { Container } from "../../components/Container"
|
||||
import { HomeFooter } from "../../components/HomeFooter"
|
||||
import { HomeHeader } from "../../components/HomeHeader"
|
||||
import { SEO } from "../../components/SEO"
|
||||
import { WavesBottom } from "../../components/Waves"
|
||||
import { Sidebar } from "../../components/Sidebar"
|
||||
import { GlobalStyles } from "../../globalStyles"
|
||||
import useLocation from "../../hooks/useLocation"
|
||||
import { useLockBodyScroll } from "../../hooks/useLockBodyScroll"
|
||||
import { ThemeProvider } from "../../ThemeProvider"
|
||||
import { ColumnLayout } from "../ColumnLayout"
|
||||
import * as SC from "./styles"
|
||||
|
||||
export const Layout: FC<RouteComponentProps> = ({ children }) => {
|
||||
export const Layout: FC<RouteComponentProps> = ({ path, children }) => {
|
||||
const { isHome } = useLocation()
|
||||
const { locked, unlock } = useLockBodyScroll()
|
||||
const pageName = path?.split("/")[1] === "rules" ? "Rules" : "About"
|
||||
|
||||
useEffect(() => {
|
||||
if (locked) {
|
||||
@@ -37,13 +37,11 @@ export const Layout: FC<RouteComponentProps> = ({ children }) => {
|
||||
)}
|
||||
{!isHome && (
|
||||
<Fragment>
|
||||
<HomeHeader isHome={isHome} />
|
||||
<SC.MainContent>
|
||||
<Container>{children}</Container>
|
||||
</SC.MainContent>
|
||||
<HomeFooter />
|
||||
<WavesBottom />
|
||||
<SC.WavesSpacer />
|
||||
<ColumnLayout
|
||||
title={pageName}
|
||||
sidebar={Sidebar}
|
||||
content={children}
|
||||
/>
|
||||
</Fragment>
|
||||
)}
|
||||
</SC.LayoutWrapper>
|
||||
|
||||
@@ -28,7 +28,7 @@ export default function BaseLayout({
|
||||
|
||||
return (
|
||||
<LocationProvider location={location}>
|
||||
<ResolvedLayout>{children}</ResolvedLayout>
|
||||
<ResolvedLayout path={location.pathname}>{children}</ResolvedLayout>
|
||||
</LocationProvider>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user