'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 { Quote as QuoteIcon } from 'lucide-react'

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

export function BlockquoteButton({ editor, disabled, isActive, executeCommand }: BlockquoteButtonProps) {
  if (!editor) return null
  return (
    <Tooltip>
      <TooltipTrigger asChild>
        <Toggle
          size="sm"
          pressed={isActive}
          onMouseDown={e => e.preventDefault()}
          onPressedChange={() => executeCommand(() => editor.chain().focus().toggleBlockquote().run())}
          disabled={disabled}
        >
          <QuoteIcon className="h-4 w-4" />
        </Toggle>
      </TooltipTrigger>
      <TooltipContent>
        <p>인용문</p>
      </TooltipContent>
    </Tooltip>
  )
}


