chore: failed attempt at adding custom field labels

I have spent all day on it and for some reason, I can't figure it out
This commit is contained in:
Ephraim Atta-Duncan
2024-02-18 16:01:03 +00:00
parent 2815b1a809
commit 986030cc38
9 changed files with 101 additions and 26 deletions

View File

@ -23,6 +23,7 @@ export type FieldItemProps = {
minWidth?: number;
onResize?: (_node: HTMLElement) => void;
onMove?: (_node: HTMLElement) => void;
onClick?: (field: Field) => void;
onRemove?: () => void;
};
@ -35,6 +36,7 @@ export const FieldItem = ({
onResize,
onMove,
onRemove,
onClick,
}: FieldItemProps) => {
const [active, setActive] = useState(false);
const [coords, setCoords] = useState({
@ -106,7 +108,10 @@ export const FieldItem = ({
width: coords.pageWidth,
}}
bounds={`${PDF_VIEWER_PAGE_SELECTOR}[data-page-number="${field.pageNumber}"]`}
onDragStart={() => setActive(true)}
onDragStart={() => {
setActive(true);
onClick?.(field);
}}
onResizeStart={() => setActive(true)}
onResizeStop={(_e, _d, ref) => {
setActive(false);