You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import { useState } from "react" ;
import {
faTrashAlt ,
faCheck
} from "@fortawesome/free-solid-svg-icons" ;
import { Button , Modal , ModalHeader , ModalBody , ModalFooter } from "reactstrap" ;
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
import { useTranslation } from "next-i18next" ;
const VoteButtonWithConfirm = ( { action } ) => {
const [ visibled , setVisibility ] = useState ( false ) ;
const { t } = useTranslation ( ) ;
const toggle = ( ) => setVisibility ( ! visibled )
return (
< div className = "input-group-append cancelButton" >
< button
type = "button"
className = "btn btn-transparent my-3 "
onClick = { toggle }
>
< div className = "annuler" >
< FontAwesomeIcon icon = { faCheck } className = "mr-2 my-auto" / >
{ t ( "Submit my vote" ) }
< / d i v >
< / b u t t o n >
< Modal
isOpen = { visibled }
toggle = { toggle }
className = "noRateVote"
>
< ModalHeader > { t ( "Attention vous n’ avez pas votez pour tous les candidats" ) } < / M o d a l H e a d e r >
< ModalBody >
{ t ( "Si vous validez votre vote, les candidats sans vote auront la mention la plus basse du scrutin." ) }
< Button
className = "addButton warningVote my-4"
onClick = { ( ) => { action ( ) ; } } >
{ t ( "Validez mon vote" ) } < img src = "/arrow-white.svg" / >
< / B u t t o n >
< Button
className = "removeButton backToVoteBtn my-4"
onClick = { toggle }
>
{ t ( "Revenir au vote" ) }
< / B u t t o n >
< / M o d a l B o d y >
< / M o d a l >
< / d i v >
) ;
}
export default VoteButtonWithConfirm ;