2021-04-26 18:36:41 +02:00
|
|
|
import React, { useContext } from "react"
|
2021-04-21 15:08:54 +02:00
|
|
|
import Style from "./Layout.module.css"
|
|
|
|
import classNames from "classnames"
|
2021-04-29 16:58:31 +02:00
|
|
|
import Sidebar from "../interactive/Sidebar"
|
|
|
|
import ContextTheme from "../../contexts/ContextTheme"
|
2021-04-21 15:08:54 +02:00
|
|
|
|
|
|
|
|
2021-04-23 02:18:06 +02:00
|
|
|
/**
|
|
|
|
* The base page layout, consisting of a {@link Sidebar} on the left and the page contents on the remaining space.
|
|
|
|
*
|
|
|
|
* @param children - The page contents.
|
|
|
|
* @param className - Additional class(es) to be added to the grid container.
|
|
|
|
* @param props - Additional props to be passed to the grid container.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2021-04-21 15:08:54 +02:00
|
|
|
export default function Layout({ children, className, ...props }) {
|
2021-04-26 18:36:41 +02:00
|
|
|
const { theme } = useContext(ContextTheme)
|
|
|
|
|
2021-04-21 15:08:54 +02:00
|
|
|
return (
|
2021-04-26 18:36:41 +02:00
|
|
|
<div className={classNames(theme, Style.Layout, className)} {...props}>
|
2021-04-21 15:08:54 +02:00
|
|
|
<Sidebar className={Style.LayoutSidebar}/>
|
2021-04-26 18:36:41 +02:00
|
|
|
<main className={Style.LayoutContent}>
|
2021-04-21 15:08:54 +02:00
|
|
|
{children}
|
2021-04-26 18:36:41 +02:00
|
|
|
</main>
|
2021-04-21 15:08:54 +02:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|