'use client'

import React from 'react'
import type { Editor } from '@tiptap/react'
import { Toggle } from '@/components/ui/toggle'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { ListOrdered as ListOrderedIcon } from 'lucide-react'

interface OrderedListButtonProps {
  editor: Editor | null
  disabled?: boolean
  isActive: boolean
  executeCommand: (command: () => void) => void
}

export function OrderedListButton({ editor, disabled, isActive, executeCommand }: OrderedListButtonProps) {
  if (!editor) return null
  return (
    <Tooltip>
      <TooltipTrigger asChild>
        <Toggle
          size="sm"
          pressed={isActive}
          onMouseDown={e => e.preventDefault()}
          onPressedChange={() => executeCommand(() => editor.chain().focus().toggleOrderedList().run())}
          disabled={disabled}
        >
          <ListOrderedIcon className="h-4 w-4" />
        </Toggle>
      </TooltipTrigger>
      <TooltipContent>
        <p>번호 매기기</p>
      </TooltipContent>
    </Tooltip>
  )
}


