Created
November 27, 2023 17:59
-
-
Save Klerith/0206389e37eaa6de6dc9c067270465cd to your computer and use it in GitHub Desktop.
Formulario para actualizar un producto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use client"; | |
import { Product } from "@/interfaces"; | |
interface Props { | |
product: Product; | |
} | |
const sizes = ["XS", "S", "M", "L", "XL", "XXL"]; | |
export const ProductForm = ({ product }: Props) => { | |
return ( | |
<form className="grid px-5 mb-16 grid-cols-1 sm:px-0 sm:grid-cols-2 gap-3"> | |
{/* Textos */} | |
<div className="w-full"> | |
<div className="flex flex-col mb-2"> | |
<span>Título</span> | |
<input type="text" className="p-2 border rounded-md bg-gray-200" /> | |
</div> | |
<div className="flex flex-col mb-2"> | |
<span>Slug</span> | |
<input type="text" className="p-2 border rounded-md bg-gray-200" /> | |
</div> | |
<div className="flex flex-col mb-2"> | |
<span>Descripción</span> | |
<textarea | |
rows={5} | |
className="p-2 border rounded-md bg-gray-200" | |
></textarea> | |
</div> | |
<div className="flex flex-col mb-2"> | |
<span>Price</span> | |
<input type="number" className="p-2 border rounded-md bg-gray-200" /> | |
</div> | |
<div className="flex flex-col mb-2"> | |
<span>Tags</span> | |
<input type="text" className="p-2 border rounded-md bg-gray-200" /> | |
</div> | |
<div className="flex flex-col mb-2"> | |
<span>Gender</span> | |
<select className="p-2 border rounded-md bg-gray-200"> | |
<option value="">[Seleccione]</option> | |
<option value="men">Men</option> | |
<option value="women">Women</option> | |
<option value="kid">Kid</option> | |
<option value="unisex">Unisex</option> | |
</select> | |
</div> | |
<div className="flex flex-col mb-2"> | |
<span>Categoria</span> | |
<select className="p-2 border rounded-md bg-gray-200"> | |
<option value="">[Seleccione]</option> | |
</select> | |
</div> | |
<button className="btn-primary w-full"> | |
Guardar | |
</button> | |
</div> | |
{/* Selector de tallas y fotos */} | |
<div className="w-full"> | |
{/* As checkboxes */} | |
<div className="flex flex-col"> | |
<span>Tallas</span> | |
<div className="flex flex-wrap"> | |
{ | |
sizes.map( size => ( | |
// bg-blue-500 text-white <--- si está seleccionado | |
<div key={ size } className="flex items-center justify-center w-10 h-10 mr-2 border rounded-md"> | |
<span>{ size }</span> | |
</div> | |
)) | |
} | |
</div> | |
<div className="flex flex-col mb-2"> | |
<span>Fotos</span> | |
<input | |
type="file" | |
multiple | |
className="p-2 border rounded-md bg-gray-200" | |
accept="image/png, image/jpeg" | |
/> | |
</div> | |
</div> | |
</div> | |
</form> | |
); | |
}; |
gracias
Bonito curso y proyecto gracias Fernando.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍