2024-07-18 12:38:07 +00:00
|
|
|
import { Mark, MarkLocation } from '../../types/mark.ts'
|
2024-07-17 08:25:02 +00:00
|
|
|
import styles from '../DrawPDFFields/style.module.scss'
|
|
|
|
import { inPx } from '../../utils/pdf.ts'
|
|
|
|
|
|
|
|
interface PdfMarkItemProps {
|
2024-07-18 12:38:07 +00:00
|
|
|
mark: Mark
|
|
|
|
handleMarkClick: (id: number) => void
|
|
|
|
isEditable: boolean
|
2024-07-17 08:25:02 +00:00
|
|
|
}
|
|
|
|
|
2024-07-18 12:38:07 +00:00
|
|
|
const PdfMarkItem = ({ mark, handleMarkClick, isEditable }: PdfMarkItemProps) => {
|
|
|
|
const handleClick = () => isEditable && handleMarkClick(mark.id);
|
2024-07-17 08:25:02 +00:00
|
|
|
return (
|
|
|
|
<div
|
2024-07-18 12:38:07 +00:00
|
|
|
onClick={handleClick}
|
|
|
|
className={`${styles.drawingRectangle} ${isEditable ? '' : styles.nonEditable}`}
|
2024-07-17 08:25:02 +00:00
|
|
|
style={{
|
2024-07-18 12:38:07 +00:00
|
|
|
left: inPx(mark.location.left),
|
|
|
|
top: inPx(mark.location.top),
|
|
|
|
width: inPx(mark.location.width),
|
|
|
|
height: inPx(mark.location.height)
|
2024-07-17 08:25:02 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PdfMarkItem
|