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

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

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

  if (!editor) {
    return null;
  }

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

export default OrderedList;
