import { useState, useEffect } from 'react' import ButtonWithConfirm from "./ButtonWithConfirm"; import TrashButton from "./TrashButton"; import { Row, Col, Label, Input, InputGroup, InputGroupAddon, Button, Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; import { useTranslation } from "react-i18next"; import { sortableHandle } from "react-sortable-hoc"; import HelpButton from "@components/form/HelpButton"; import AddPicture from "@components/form/AddPicture"; import { faPlus, faCogs, faCheck, faTrash } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; const DragHandle = sortableHandle(({ children }) => ( {children} )); const CandidateField = ({ avatar, label, description, candIndex, onDelete, onAdd, ...inputProps }) => { const { t } = useTranslation(); const [visibled, setVisibility] = useState(false); const toggle = () => setVisibility(!visibled) const [selected, setSelectedState] = useState(false); const [className , setClassName] = useState("none"); const [trashIcon , setTrashIcon] = useState("none"); const [plusIcon , setPlusIcon] = useState("none"); const addCandidate = () => { toggle(); onAdd(); } useEffect(() => { setClassName("candidateButton " + (selected ? "candidateAdded" : "")) }, [selected] ); useEffect(() => { setPlusIcon("mr-2 cursorPointer " + (selected ? "trashIcon" : "")) }, [selected] ); useEffect(() => { setTrashIcon("trashIcon " + (selected ? "displayTrash" : "")) }, [selected] ); const addFunction = () => { addCandidate(); setSelectedState(!selected); } const [image, setImage] = useState(null); const [createObjectURL, setCreateObjectURL] = useState(null); const uploadToClient = (event) => { if (event.target.files && event.target.files[0]) { const i = event.target.files[0]; setImage(i); setCreateObjectURL(URL.createObjectURL(i)); } }; return (
Ajouter un participant

Ajoutez une photo, le nom et une description au candidat.

Photo (facultatif)

Importer une photo.
format : jpg, png, pdf

{/* {t( "Enter the name of your candidate or proposal here (250 characters max.)" )} */}
); } export default CandidateField