import { IconIndentDecrease } from '@tabler/icons-react';

import ActionButton from '../components/ActionButton';
import { useTextArea } from '../context';

const Outdent = ({ title }: { title: string }) => {
  const { editor } = useTextArea();

  if (!editor) {
    return null;
  }

  return (
    <ActionButton
      title={title}
      icon={<IconIndentDecrease />}
      onClick={() => editor.chain().focus().outdent().run()}
      isActive={editor.isActive('outdent')}
    />
  );
};

export default Outdent;
