import clsx from 'clsx'; import React from 'react'; import { Position } from '@/utils/sel'; import { BookNote, HighlightColor, HighlightStyle } from '@/types/book'; import Popup from '@/components/Popup'; import AnnotationToolButton from './AnnotationToolButton'; import AnnotationNotes from './AnnotationNotes'; import HighlightOptions from './HighlightOptions'; interface AnnotationPopupProps { bookKey: string; dir: 'ltr' | 'rtl'; isVertical: boolean; buttons: Array<{ tooltipText: string; Icon: React.ElementType; onClick: () => void; disabled?: boolean; visible?: boolean; }>; notes: BookNote[]; position: Position; trianglePosition: Position; highlightOptionsVisible: boolean; selectedStyle: HighlightStyle; selectedColor: HighlightColor; popupWidth: number; popupHeight: number; onHighlight: (update?: boolean) => void; onDismiss: () => void; } const AnnotationPopup: React.FC = ({ bookKey, dir, isVertical, buttons, notes, position, trianglePosition, highlightOptionsVisible, selectedStyle, selectedColor, popupWidth, popupHeight, onHighlight, onDismiss, }) => { return (
0 && 'bg-transparent', )} triangleClassName='text-gray-600' onDismiss={onDismiss} >
0 && 'hidden', )} style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }} > {buttons.map((button, index) => { if (button.visible === false) return null; return ( ); })}
{notes.length > 0 ? ( ) : ( highlightOptionsVisible && ( ) )}
); }; export default AnnotationPopup;