import { usePPTEditContext } from '../../context'
import { Tooltip } from './toolbar'

export const PPTEditToolBar: React.FC<{
  containerRef: React.RefObject<HTMLDivElement | null>
  className?: string
}> = props => {
  const { containerRef, className } = props
  const context = usePPTEditContext()
  if (!context || !context.state) {
    return null
  }
  const { selectedElement, editor, tipPosition } = context.state
  return (
    <Tooltip
      editor={editor}
      element={selectedElement}
      position={tipPosition}
      containerRef={containerRef}
      className={className}
    />
  )
}
