File size: 729 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
import React from 'react';
import type { SlateProps } from '../types/component';
import PluginButton from './PluginButton';
import { useTheme } from '@mui/material';
const Controls = (props: Pick<SlateProps, 'translations' | 'plugins'>) => {
  const { plugins, translations } = props;
  const theme = useTheme();

  const dark = theme.palette.mode === 'dark';

  return (
    <div>
      {plugins &&
        plugins.map((plugin, i: number) =>
          plugin.addToolbarButton ? (
            <PluginButton
              key={i}
              translations={translations}
              plugin={plugin}
              dark={dark}
            />
          ) : null
        )}
    </div>
  );
};

export default React.memo(Controls);