import React from 'react'; import Icon from '../Icon'; import OuterRect from '../OuterRect'; import { AnnotationContainer } from '../../global/otherStyled'; import { rectCalc } from '../../helpers/position'; import { TextArea, TextAreaContainer, TrashCan } from './styled'; const StickyNote: React.SFC = ({ id, viewport, scale, obj_attr: { position, content }, onEdit, isEdit, onBlur, onUpdate, onDelete, }: AnnotationElementPropsType) => { const annotRect = rectCalc(position as PositionType, viewport.height, scale); const handleClick = (event: React.MouseEvent): void => { event.preventDefault(); onEdit(); }; const handleChange = ( event: React.ChangeEvent, ): void => { const textValue = event.currentTarget.value; onUpdate({ content: textValue, }); }; const handleMove = (moveCoord: CoordType): void => { const top = (viewport.height - moveCoord.top) / scale; const left = moveCoord.left / scale; onUpdate({ position: { top, left, bottom: top, right: left, }, }); }; return ( <> {isEdit ? (