import { Button } from '@heroui/button' import { Image } from '@heroui/image' import { Input } from '@heroui/input' import { useRef } from 'react' export interface ImageInputProps { onChange: (base64: string) => void value: string label?: string } const ImageInput: React.FC = ({ onChange, value, label }) => { const inputRef = useRef(null) return (
{label}
{ const file = e.target.files?.[0] if (file) { const reader = new FileReader() reader.onload = async () => { const base64 = reader.result as string onChange(base64) } reader.readAsDataURL(file) } }} />
) } export default ImageInput