StatusBar.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* eslint-disable @typescript-eslint/no-non-null-assertion */
  2. /* eslint-disable @typescript-eslint/no-explicit-any */
  3. import * as React from 'react'
  4. import { observer } from 'mobx-react-lite'
  5. import { useApp } from '@tldraw/react'
  6. import type { Shape } from '../../lib'
  7. export const StatusBar = observer(function StatusBar() {
  8. const app = useApp<Shape>()
  9. React.useEffect(() => {
  10. const canvas = document.querySelector<HTMLElement>('.logseq-tldraw-wrapper .tl-canvas')
  11. const actionBar = document.querySelector<HTMLElement>('.logseq-tldraw-wrapper .tl-action-bar')
  12. if (canvas) {
  13. canvas.style.height = 'calc(100% - 32px)'
  14. }
  15. if (actionBar) {
  16. actionBar.style.marginBottom = '32px'
  17. }
  18. return () => {
  19. if (canvas) {
  20. canvas.style.height = '100%'
  21. }
  22. if (actionBar) {
  23. actionBar.style.marginBottom = '0px'
  24. }
  25. }
  26. })
  27. return (
  28. <div className="tl-statusbar">
  29. {app.selectedTool.id} | {app.selectedTool.currentState.id}
  30. <div style={{ flex: 1 }} />
  31. <div id="tl-statusbar-anchor" style={{ display: 'flex' }} />
  32. </div>
  33. )
  34. })