Generateurv2/frontend/components/pdf_gen/PdfForm.jsx
2022-06-24 13:42:16 +02:00

67 lines
1.8 KiB
JavaScript

import { useState } from "react";
import styles from "../../styles/pdf_gen/pdfForm.module.scss";
import Input from "../Input.jsx";
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"
placeholder="Nom du fichier"
value={param.name}
onChange={(e) => {
setParam({ ...param, name: e.target.value });
}}
/>
<Input
type="text"
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>
);
}