import React from 'react'; import Icon from './Icon'; /** * @typedef {Object} UploadButtonProps * @property {string} value * @property {React.MutableRefObject} inputRef * @property {function} onChange */ /** * Upload button * @param {UploadButtonProps} props */ export default function UploadButton(props) { let openfile = () => { const input = props.inputRef.current; if (props.value) { props.onChange(''); } else { input.click(); } }; /** * @param {React.ChangeEvent} event */ let attachmentChanged = (event) => { props.onChange(event.target.value); }; return (
e.stopPropagation()} style={{ display: 'none' }} ref={props.inputRef} value={props.value} onChange={attachmentChanged} />
); } const inactiveStyle = { cursor: 'pointer', color: '#888' }; const activeStyle = { cursor: 'pointer', color: 'green' };