parameterize button label

This commit is contained in:
Eduardo Quiros 2022-08-30 04:03:09 -06:00
parent 99788e7121
commit a1023fda37
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
1 changed files with 17 additions and 1 deletions

View File

@ -29,6 +29,7 @@ const RegistroComunicado = () => {
const [comunicado, setComunicado] = useState(emptyComunicado);
const [comunicados, setComunicados] = useState([]);
const [saveButtonLabel, setSaveButtonLabel] = useState('Registrar');
const [comunicadoId, setComunicadoId] = useState(null);
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
const [submitted, setSubmitted] = useState(false);
@ -204,7 +205,22 @@ const RegistroComunicado = () => {
</div>
</div>
</div>
<Button label="Registrar" onClick={saveComunicado} />
<div style={{
display: "flex",
justifyContent: "center",
gap: "10px",
width: "100%"
}}>
<Button
label={`${saveButtonLabel}`}
onClick={() => saveComunicado()}
/>
{saveButtonLabel === 'Actualizar' && (
<Button
label="Cancelar"
onClick={cancelEdit}
className="p-button-danger" />)}
</div>
</div>
</div>
</div>