Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3719 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3719 Rev 3736
Línea 12... Línea 12...
12
  all: 'image/jpeg, image/png, image/jpg, application/pdf, application/vnd.openxmlformats-officedocument.presentationml.presentation, video/mp4, video/mpeg, video/webm, video/quicktime, audio/mpeg, audio/mp3, audio/wav, audio/ogg'
12
  all: 'image/jpeg, image/png, image/jpg, application/pdf, application/vnd.openxmlformats-officedocument.presentationml.presentation, video/mp4, video/mpeg, video/webm, video/quicktime, audio/mpeg, audio/mp3, audio/wav, audio/ogg'
13
};
13
};
Línea 14... Línea 14...
14
 
14
 
15
export function FilePicker({
15
export function FilePicker({
16
  type = 'image',
-
 
17
  multiple = false,
16
  type = 'image',
18
  maxFiles = 1,
17
 
19
  description = 'Arrastra el archivo aqui, o haga click para seleccionar',
18
  description = 'Arrastra el archivo aqui, o haga click para seleccionar',
20
  onChange = () => {}
19
  onChange = () => {}
21
}) {
20
}) {
22
  const [files, setFiles] = useState([]);
21
  const [files, setFiles] = useState([]);
Línea 23... Línea 22...
23
  const [errors, setErrors] = useState([]);
22
  const [errors, setErrors] = useState([]);
24
 
23
 
25
  const { getRootProps, getInputProps } = useDropzone({
24
  const { getRootProps, getInputProps } = useDropzone({
26
    accept: FILE_TYPES[type] ?? FILE_TYPES.image,
-
 
27
    multiple,
25
    accept: FILE_TYPES[type] ?? FILE_TYPES.image,
28
    maxFiles,
26
    multiple: false,
29
    onDropAccepted: (files) => {
27
    onDropAccepted: (files) => {
30
      setFiles(files);
28
      setFiles(files);
31
      onChange(multiple ? files : files[0]);
29
      onChange(files);
32
    },
30
    },
33
    onDropRejected: (rejections) => {
31
    onDropRejected: (rejections) => {
34
      if (rejections.length === 0) return;
32
      if (rejections.length === 0) return;