import React from 'react'; import { useTranslation } from 'react-i18next'; import Button from '../components/Button'; import ExpansionPanel from '../components/ExpansionPanel'; import Icon from '../components/Icon'; import HighlightTools from './HighlightTools'; import FreehandTool from './FreehandTool'; import TextTool from './FreeTextTool'; import StickyNoteTool from './StickyNoteTool'; import ShapeTool from './ShapeTool'; import useActions from '../actions'; import useStore from '../store'; type Props = { sidebarState: string; onClickSidebar: (state: string) => void; }; const MarkupTools: React.FC = ({ sidebarState, onClickSidebar, }: Props) => { const { t } = useTranslation('sidebar'); const [{ toolState }, dispatch] = useStore(); const { setTool } = useActions(dispatch); const onClickTool = (state: string): void => { if (state === toolState) { setTool(''); } else { setTool(state); } }; const isActive = sidebarState === 'markup-tools'; const Label = ( ); return ( { onClickTool('highlight'); }} /> { onClickTool('freehand'); }} /> { onClickTool('text'); }} /> { onClickTool('sticky'); }} /> { onClickTool('shape'); }} /> ); }; export default MarkupTools;