añadido soporte para sacar la y y volverla a añadir
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { useState } from "react";
|
||||
export default function EditarModal({ tipo, coord, show, close, setCoords }) {
|
||||
if (coord == null) return null;
|
||||
const [hasY, setHasY] = useState(coord.y !== null);
|
||||
|
||||
const handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -50,6 +54,18 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="mb-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="form-check-input me-2"
|
||||
checked={hasY}
|
||||
onChange={(e) => {
|
||||
coord.y = e.target.checked ? "0" : null;
|
||||
setHasY(e.target.checked);
|
||||
}}
|
||||
/>
|
||||
<label className="form-label">Lleva coordenada Y?</label>
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Coordenada X</label>
|
||||
<input
|
||||
@@ -59,7 +75,7 @@ export default function EditarModal({ tipo, coord, show, close, setCoords }) {
|
||||
defaultValue={coord.x}
|
||||
/>
|
||||
</div>
|
||||
{coord.y != null && (
|
||||
{hasY && (
|
||||
<div className="mb-3">
|
||||
<label className="form-label">Coordenada Y</label>
|
||||
<input
|
||||
|
||||
Reference in New Issue
Block a user