aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/editor/EditorButtons.jsx
blob: b9f0d0762cf4aec920a7d82343e9866918290623 (plain) (blame)
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
import { observer } from 'mobx-react-lite';
import React from 'react';
import IconButton from '@material-ui/core/IconButton';
import RedoIcon from '@material-ui/icons/Redo';
import UndoIcon from '@material-ui/icons/Undo';

import { useRootStore } from '../RootStore';

export default observer(() => {
  const editorStore = useRootStore().editorStore;
  return (
    <>
      <IconButton
        disabled={!editorStore.canUndo}
        onClick={() => editorStore.undo()}
      >
        <UndoIcon fontSize='small'/>
      </IconButton>
      <IconButton
        disabled={!editorStore.canRedo}
        onClick={() => editorStore.redo()}
      >
        <RedoIcon fontSize='small'/>
      </IconButton>
    </>
  );
});