1import React, { useCallback } from 'react';
2import { useField } from 'react-final-form';
3import UploadButton from 'components/UploadButton';
4import { AccessoryIcon } from 'indigo-react';
6export default function UploadInput({ name, label, ...rest }) {
9 meta: { validating, submitting, touched, active, error },
10 } = useField(name, { type: 'text' });
12 const handleUpload = useCallback(
16 const file = element.files.item(0);
17 const reader = new FileReader();
19 reader.onload = e => {
20 input.onChange({ target: { value: e.target.result } });
23 const failure = _ => {
27 reader.onerror = failure;
28 reader.onabort = failure;
30 reader.readAsText(file);
37 onChange={handleUpload}
39 touched && !active && error ? (
40 <AccessoryIcon.Failure />
41 ) : validating || submitting ? (
42 <AccessoryIcon.Pending />
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list