import Icon from './Icon' /** * @typedef {object} UploadButtonProps * @property {string} value * @property {import('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 {import('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' }