You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

editor.tsx 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import useKeyboardEvents from 'hooks/useKeyboardEvents'
  2. import useLoadOnMount from 'hooks/useLoadOnMount'
  3. import Menu from './menu/menu'
  4. import Canvas from './canvas/canvas'
  5. import StatusBar from './status-bar'
  6. import ToolsPanel from './tools-panel/tools-panel'
  7. import StylePanel from './style-panel/style-panel'
  8. import styled from 'styles'
  9. import PagePanel from './page-panel/page-panel'
  10. import CodePanel from './code-panel/code-panel'
  11. import DebugPanel from './debug-panel/debug-panel'
  12. import ControlsPanel from './controls-panel/controls-panel'
  13. export default function Editor({ roomId }: { roomId?: string }): JSX.Element {
  14. useKeyboardEvents()
  15. useLoadOnMount(roomId)
  16. return (
  17. <Layout>
  18. <MenuButtons>
  19. <Menu />
  20. <DebugPanel />
  21. <CodePanel />
  22. <PagePanel />
  23. </MenuButtons>
  24. <ControlsPanel />
  25. <Spacer />
  26. <StylePanel />
  27. <Canvas />
  28. <ToolsPanel />
  29. <StatusBar />
  30. </Layout>
  31. )
  32. }
  33. const Spacer = styled('div', {
  34. flexGrow: 2,
  35. })
  36. const MenuButtons = styled('div', {
  37. display: 'flex',
  38. gap: 8,
  39. })
  40. const Layout = styled('main', {
  41. position: 'fixed',
  42. overflow: 'hidden',
  43. top: 0,
  44. left: 0,
  45. bottom: 0,
  46. right: 0,
  47. height: '100%',
  48. width: '100%',
  49. padding: '8px 8px 0 8px',
  50. zIndex: 200,
  51. display: 'flex',
  52. alignItems: 'flex-start',
  53. justifyContent: 'flex-start',
  54. pointerEvents: 'none',
  55. '& > *': {
  56. PointerEvent: 'all',
  57. },
  58. })