UNPKG

stackpress

Version:

Incept is a content management framework.

29 lines (28 loc) 1.99 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useEffect } from 'react'; import NotifyContainer from '../notify/NotifyContainer'; import { unload } from '../notify/hooks'; import { useTheme } from '../theme/hooks'; import { useConfig, useRequest } from '../server/hooks'; import LayoutHead from './components/LayoutHead'; import LayoutLeft from './components/LayoutLeft'; import LayoutMain from './components/LayoutMain'; import LayoutMenu from './components/LayoutMenu'; import LayoutRight from './components/LayoutRight'; import LayoutProvider from './LayoutProvider'; import { useToggle } from './hooks'; 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} relative overflow-hidden px-w-100-0 px-h-100-0 theme-bg-bg0 theme-tx1`, children: [_jsx(LayoutHead, { open: left, 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, 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, {})] })); }