Spaces:
Running
Running
File size: 907 Bytes
5f07a23 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import { useEffect, useRef } from 'react';
const TextInput = ({
isTyping,
textInputRef,
textInput,
setTextInput,
handleTextInput,
textPosition
}) => {
if (!isTyping) {
return null;
}
return (
<div
className="absolute z-50 bg-white border border-gray-300 rounded-lg shadow-medium p-2"
style={{
top: textPosition.y,
left: textPosition.x,
transform: 'translateY(-100%)'
}}
>
<input
ref={textInputRef}
type="text"
value={textInput}
onChange={(e) => setTextInput(e.target.value)}
onKeyDown={handleTextInput}
placeholder="Type text..."
className="w-full p-2 bg-gray-50 border border-gray-200 rounded-lg text-gray-800 focus:outline-none focus:ring-2 focus:ring-gray-400"
aria-label="Text input for canvas"
/>
</div>
);
};
export default TextInput; |