jotazetaec

Untitled

Dec 10th, 2025 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { useState } from "react";
  2.  
  3. function Formulario() {
  4.   const [favorito, setFavorito] = useState(false);
  5.  
  6.   return (
  7.     <div>
  8.       <div>
  9.         <img
  10.           src="https://picsum.photos/500/300"
  11.           alt="Laptop Gamer"
  12.         />
  13.        
  14.         <div>
  15.           <h2>Laptop Gamer</h2>
  16.           <p>
  17.             Laptop con RTX 4060, 16GB RAM, ideal para gaming y desarrollo.
  18.           </p>
  19.          
  20.           <h3>$1,299.99</h3>
  21.          
  22.           <div>
  23.             <span>Disponible</span>
  24.             <span>Envío gratis</span>
  25.           </div>
  26.          
  27.           <div>
  28.             <button
  29.               onClick={() => setFavorito(!favorito)}
  30.             >
  31.               {favorito ? '❤️ En favoritos' : '🤍 Añadir a favoritos'}
  32.             </button>
  33.           </div>
  34.          
  35.           <div>
  36.             <button>
  37.               Comprar ahora
  38.             </button>
  39.             <button>
  40.               Añadir al carrito
  41.             </button>
  42.           </div>
  43.         </div>
  44.       </div>
  45.     </div>
  46.   );
  47. }
  48.  
  49. export default Formulario;
  50.  
  51.  
  52. ---------------------------------------------
  53. --con css boostrap
  54.  
  55. import { useState } from "react";
  56.  
  57. function Formulario() {
  58.   const [favorito, setFavorito] = useState(false);
  59.  
  60.   return (
  61.     <div className="container my-5">
  62.       <div className="card shadow-sm" style={{ maxWidth: '500px', margin: '0 auto' }}>
  63.         <img
  64.           src="https://picsum.photos/400/300"
  65.           className="card-img-top"
  66.           // className="rounded-circle d-block mx-auto" width="150" height="150"
  67.           alt="Laptop Gamer"
  68.         />
  69.        
  70.         <div className="card-body text-center">
  71.           <h2 className="card-title">Laptop Gamer</h2>
  72.           <p className="card-text">
  73.             Laptop con RTX 4060, 16GB RAM, ideal para gaming y desarrollo.
  74.           </p>
  75.          
  76.           <h3 className="text-primary fw-bold mb-4">$1,299.99</h3>
  77.          
  78.           <div className="mb-3">
  79.             <span className="badge bg-success me-2">Disponible</span>
  80.             <span className="badge bg-warning">Envío gratis</span>
  81.           </div>
  82.          
  83.           <div className="mb-4">
  84.             <button
  85.               className={`btn ${favorito ? 'btn-danger' : 'btn-outline-danger'} w-100`}
  86.               onClick={() => setFavorito(!favorito)}
  87.             >
  88.               {favorito ? '❤️ En favoritos' : '🤍 Añadir a favoritos'}
  89.             </button>
  90.           </div>
  91.          
  92.           <div className="d-grid gap-2">
  93.             <button className="btn btn-primary btn-lg">
  94.               Comprar ahora
  95.             </button>
  96.             <button className="btn btn-outline-secondary">
  97.               Añadir al carrito
  98.             </button>
  99.           </div>
  100.         </div>
  101.       </div>
  102.     </div>
  103.   );
  104. }
  105.  
  106. export default Formulario;
Advertisement
Add Comment
Please, Sign In to add comment