UNPKG

stackpress

Version:

Incept is a content management framework.

29 lines (28 loc) 1.98 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useEffect } from 'react'; import NotifyContainer from '../notify/NotifyContainer.js'; import { unload } from '../notify/hooks.js'; import { useTheme } from '../theme/hooks.js'; import { useConfig, useRequest } from '../server/hooks.js'; import LayoutHead from './components/LayoutHead.js'; import LayoutLeft from './components/LayoutLeft.js'; import LayoutMain from './components/LayoutMain.js'; import LayoutMenu from './components/LayoutMenu.js'; import LayoutRight from './components/LayoutRight.js'; import LayoutProvider from './LayoutProvider.js'; import { useToggle } from './hooks.js'; export function PanelApp(props) { const { menu, children } = props; const config = useConfig(); const request = useRequest(); const [left, toggleLeft] = useToggle(); const [right, toggleRight] = useToggle(); const { theme, toggle: toggleTheme } = useTheme(); const pathname = request.url.pathname; return (_jsxs("div", { className: `${theme} layout-panel`, children: [_jsx(LayoutHead, { open: { left, right }, theme: theme, toggleLeft: toggleLeft, toggleRight: toggleRight, toggleTheme: toggleTheme }), _jsx(LayoutLeft, { brand: config.path('brand.name', 'Stackpress'), base: config.path('view.base', '/'), logo: config.path('brand.icon', 'icon.png'), open: left, toggle: toggleLeft, children: menu ? (_jsx(LayoutMenu, { path: pathname, menu: menu })) : props.left }), _jsx(LayoutRight, { open: right, children: props.right }), _jsx(LayoutMain, { open: { left, right }, children: children })] })); } export default function LayoutPanel(props) { const { data, session, request, response, menu, left, right, children } = props; useEffect(unload, []); return (_jsxs(LayoutProvider, { data: data, session: session, request: request, response: response, children: [_jsx(PanelApp, { left: left, right: right, menu: menu, children: children }), _jsx(NotifyContainer, {})] })); }