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

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

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

  if (!editor) {
    return null;
  }

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

export default Indent;
