Generateurv2/frontend/components/pdf_gen/PdfForm.jsx
2022-05-18 10:15:54 +02:00

68 lines
1.8 KiB
JavaScript

import { useState } from "react";
import styles from "../../styles/pdf_gen/pdfForm.module.scss";
export default function PdfForm({submit}) {
const [param, setParam] = useState({
name: "",
entete: "",
police: 14,
});
return (
<div className={styles.main}>
<div className="">
<h1>Fiche PDF</h1>
<div className={styles.form}>
<input
type="text"
className="exo-input"
placeholder="Nom du fichier"
value={param.name}
onChange={(e) => {
setParam({ ...param, name: e.target.value });
}}
/>
<input
type="text"
className="exo-input"
placeholder="Entête de fiche"
value={param.entete}
onChange={(e) => {
setParam({ ...param, entete: e.target.value });
}}
/>
{/* <input
type="number"
className="exo-input"
min={10}
max={18}
step={2}
placeholder="Police (entre 10 et 18)"
value={param.police}
onChange={(e) => {
if (
parseInt(e.target.value) <=
18 /* && parseInt(e.target.value) >= 10 *||
e.target.value == ""
) {
setParam({ ...param, police: parseInt(e.target.value) });
} /* else if (parseInt(e.target.value) <= 10) {
setParam({ ...param, police: 10 });
}* else if (isNaN(parseInt(e.target.value))) {
setParam({ ...param });
}
}}
/> */}
</div>
<button
className="exo-btn"
onClick={(e) => {
submit(param)
}}
>
Télécharger !
</button>
</div>
</div>
);
}