Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 11347 Rev 15925
Línea 1... Línea 1...
1
import React, { useEffect, useState } from "react";
1
import React, { useEffect, useState } from "react";
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea -...
3
import styles from "./fileModal.module.scss";
-
 
4
 
-
 
5
const FileModal = (props) => {
3
import styles from "./fileModal.module.scss";
6
  // props destructuring
-
 
7
  const { file, onCancel, onSend } = props;
4
 
Línea 8... Línea 5...
8
 
5
const FileModal = ({ file, onCancel, onSend }) => {
9
  const [fileUrl, setFileUrl] = useState("");
6
  const [fileUrl, setFileUrl] = useState("");
10
 
-
 
11
  useEffect(() => {
7
 
12
    const reader = new FileReader();
-
 
13
    reader.onloadend = () => {
8
  useEffect(() => {
14
      setFileUrl(reader.result);
-
 
15
    };
9
    const reader = new FileReader();
Línea 16... Línea -...
16
    reader.readAsDataURL(file);
-
 
17
     (file.type);
10
    reader.onloadend = () => setFileUrl(reader.result);
18
  }, []);
11
    reader.readAsDataURL(file);
19
 
12
  }, []);
20
  // "video/mp4, video/mpeg, video/webm, application/pdf, image/jpeg, image/png, image/jpg";
13
 
21
  const filePreview = () => {
14
  const filePreview = () => {
Línea 50... Línea 43...
50
        break;
43
        break;
51
    }
44
    }
52
  };
45
  };
Línea 53... Línea 46...
53
 
46
 
54
  return (
47
  return (
55
    <div className={styles.fileModal}>
48
    <div className={styles.file_modal}>
56
      {fileUrl && filePreview()}
49
      {fileUrl && filePreview()}
57
      <div className={styles.buttonsContainer}>
-
 
58
        <button className={styles.button} onClick={onCancel}>
-
 
59
          Cancelar
-
 
60
        </button>
50
      <div className={styles.buttons_container}>
61
        <button className={styles.button} onClick={onSend}>
51
        <button className="btn btn-primary" onClick={onSend}>
62
          Enviar
52
          Enviar
-
 
53
        </button>
-
 
54
        <button className="btn btn-secondary" onClick={onCancel}>
-
 
55
          Cancelar
63
        </button>
56
        </button>
64
      </div>
57
      </div>
65
    </div>
58
    </div>
66
  );
59
  );