2021-05-29 10:12:28 +00:00
|
|
|
import useKeyboardEvents from 'hooks/useKeyboardEvents'
|
|
|
|
import useLoadOnMount from 'hooks/useLoadOnMount'
|
2021-07-14 08:04:07 +00:00
|
|
|
import useStateTheme from 'hooks/useStateTheme'
|
2021-07-10 16:14:49 +00:00
|
|
|
import Menu from './menu/menu'
|
2021-05-29 10:12:28 +00:00
|
|
|
import Canvas from './canvas/canvas'
|
|
|
|
import ToolsPanel from './tools-panel/tools-panel'
|
|
|
|
import StylePanel from './style-panel/style-panel'
|
|
|
|
import styled from 'styles'
|
2021-06-03 12:06:39 +00:00
|
|
|
import PagePanel from './page-panel/page-panel'
|
2021-06-23 22:32:21 +00:00
|
|
|
import CodePanel from './code-panel/code-panel'
|
2021-07-04 18:45:07 +00:00
|
|
|
import DebugPanel from './debug-panel/debug-panel'
|
2021-06-25 10:28:52 +00:00
|
|
|
import ControlsPanel from './controls-panel/controls-panel'
|
2021-05-09 13:04:42 +00:00
|
|
|
|
2021-06-28 20:45:06 +00:00
|
|
|
export default function Editor({ roomId }: { roomId?: string }): JSX.Element {
|
2021-05-12 11:27:33 +00:00
|
|
|
useKeyboardEvents()
|
2021-06-28 20:45:06 +00:00
|
|
|
useLoadOnMount(roomId)
|
2021-07-14 08:04:07 +00:00
|
|
|
useStateTheme()
|
2021-05-12 11:27:33 +00:00
|
|
|
|
2021-05-09 13:04:42 +00:00
|
|
|
return (
|
2021-05-17 10:01:11 +00:00
|
|
|
<Layout>
|
2021-07-10 16:14:49 +00:00
|
|
|
<MenuButtons>
|
|
|
|
<Menu />
|
|
|
|
<DebugPanel />
|
|
|
|
<CodePanel />
|
|
|
|
<PagePanel />
|
|
|
|
</MenuButtons>
|
2021-06-25 10:28:52 +00:00
|
|
|
<ControlsPanel />
|
2021-06-03 16:13:23 +00:00
|
|
|
<Spacer />
|
|
|
|
<StylePanel />
|
|
|
|
<Canvas />
|
2021-05-29 10:12:28 +00:00
|
|
|
<ToolsPanel />
|
2021-05-17 10:01:11 +00:00
|
|
|
</Layout>
|
2021-05-09 13:04:42 +00:00
|
|
|
)
|
|
|
|
}
|
2021-05-17 10:01:11 +00:00
|
|
|
|
2021-06-03 16:13:23 +00:00
|
|
|
const Spacer = styled('div', {
|
|
|
|
flexGrow: 2,
|
|
|
|
})
|
|
|
|
|
2021-07-10 16:14:49 +00:00
|
|
|
const MenuButtons = styled('div', {
|
|
|
|
display: 'flex',
|
|
|
|
gap: 8,
|
|
|
|
})
|
|
|
|
|
2021-06-01 21:49:32 +00:00
|
|
|
const Layout = styled('main', {
|
2021-05-29 10:12:28 +00:00
|
|
|
position: 'fixed',
|
2021-06-18 14:39:07 +00:00
|
|
|
overflow: 'hidden',
|
2021-05-17 10:01:11 +00:00
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
2021-05-30 13:39:53 +00:00
|
|
|
height: '100%',
|
|
|
|
width: '100%',
|
2021-06-03 16:13:23 +00:00
|
|
|
padding: '8px 8px 0 8px',
|
|
|
|
zIndex: 200,
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'flex-start',
|
|
|
|
justifyContent: 'flex-start',
|
2021-07-11 12:51:01 +00:00
|
|
|
boxSizing: 'border-box',
|
|
|
|
|
2021-06-01 21:49:32 +00:00
|
|
|
pointerEvents: 'none',
|
2021-06-03 16:13:23 +00:00
|
|
|
'& > *': {
|
|
|
|
PointerEvent: 'all',
|
|
|
|
},
|
2021-05-26 10:34:10 +00:00
|
|
|
})
|