File size: 1,280 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import type { FC, PropsWithChildren } from 'react';
import React from 'react';
import { BottomToolbarDrawer } from './Drawer';
import { BottomToolbarMainBar } from './NodeTools';
import { ScaleButton } from './ScaleButton';
import type { BottomToolbarProps } from './types';
export * from './types';
export * from './Drawer';
export * from './NodeTools';
export * from './Tools';

export const BottomToolbar: FC<PropsWithChildren<BottomToolbarProps>> =
  React.memo(
    ({
      open = false,
      className,

      anchor = 'bottom',
      pluginControls,
      nodeId,
      actionsLeft,
      style,
      children,
    }) => {
      const [scale, setScale] = React.useState(1);

      return (
        <BottomToolbarDrawer
          className={className}
          open={open}
          anchor={anchor}
          scale={scale}
          style={style}
        >
          {children}
          {pluginControls}
          <BottomToolbarMainBar
            nodeId={nodeId}
            actionsLeft={[
              <ScaleButton
                key="scalebutton"
                scale={scale}
                setScale={setScale}
              />,
              ...React.Children.toArray(actionsLeft),
            ]}
          />
        </BottomToolbarDrawer>
      );
    }
  );