-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alejandro Carreño
committed
Aug 25, 2024
1 parent
67ba3ad
commit 8487a53
Showing
5 changed files
with
190 additions
and
122 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,135 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; | ||
import './App.css'; | ||
|
||
|
||
// Definimos el Navbar | ||
const Navbar = () => { | ||
const handleLinkClick = (url, e) => { | ||
e.preventDefault(); | ||
window.open(url, "_blank"); // Abre la página en una nueva pestaña | ||
}; | ||
|
||
return ( | ||
<> | ||
<nav className="navbar"> | ||
<img src={require('./imagenes/logo.png')} alt="Logo" className="logo" /> | ||
<ul className="nav-links"> | ||
<li> | ||
<a href="#promociones" onClick={(e) => handleLinkClick('/promociones', e)}> | ||
Promociones | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#menu" onClick={(e) => handleLinkClick('/menu', e)}> | ||
Menú | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#combos" onClick={(e) => handleLinkClick('/combos', e)}> | ||
Combos | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
<Carousel /> | ||
<ImageBelowCarousel /> | ||
<Footer /> | ||
</> | ||
); | ||
const handleLinkClick = (url, e) => { | ||
e.preventDefault(); | ||
window.open(url, "_blank"); // Abre la página en una nueva pestaña | ||
}; | ||
|
||
return ( | ||
<nav className="navbar"> | ||
<img src={require('./imagenes/logo.png')} alt="Logo" className="logo" /> | ||
<ul className="nav-links"> | ||
<li> | ||
<a href="#promociones" onClick={(e) => handleLinkClick('/promociones', e)}> | ||
Promociones | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#menu" onClick={(e) => handleLinkClick('/menu', e)}> | ||
Menú | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#combos" onClick={(e) => handleLinkClick('/combos', e)}> | ||
Combos | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
); | ||
}; | ||
|
||
// Definimos el Carousel | ||
const Carousel = () => { | ||
const [currentSlide, setCurrentSlide] = useState(0); | ||
|
||
const slides = [ | ||
require('./imagenes/cs1.png'), | ||
require('./imagenes/c2.png'), | ||
require('./imagenes/c3.png') | ||
require('./imagenes/cs1.png'), | ||
require('./imagenes/c2.png'), | ||
require('./imagenes/c3.png') | ||
]; | ||
|
||
const nextSlide = () => { | ||
setCurrentSlide((prevSlide) => (prevSlide + 1) % slides.length); | ||
setCurrentSlide((prevSlide) => (prevSlide + 1) % slides.length); | ||
}; | ||
|
||
useEffect(() => { | ||
const slideInterval = setInterval(() => { | ||
nextSlide(); | ||
}, 4000); | ||
const slideInterval = setInterval(() => { | ||
nextSlide(); | ||
}, 4000); | ||
|
||
return () => clearInterval(slideInterval); | ||
return () => clearInterval(slideInterval); | ||
}, [currentSlide]); | ||
|
||
return ( | ||
<div className="carousel-container"> | ||
<div className="carousel" style={{ transform: `translateX(-${currentSlide * 100}%)` }}> | ||
{slides.map((slide, index) => ( | ||
<div className="carousel-item" key={index}> | ||
<img src={slide} alt={`Slide ${index + 1}`} /> | ||
</div> | ||
))} | ||
<div className="carousel-container"> | ||
<div className="carousel" style={{ transform: `translateX(-${currentSlide * 100}%)` }}> | ||
{slides.map((slide, index) => ( | ||
<div className="carousel-item" key={index}> | ||
<img src={slide} alt={`Slide ${index + 1}`} /> | ||
</div> | ||
<button className="carousel-control prev" onClick={() => setCurrentSlide((currentSlide - 1 + slides.length) % slides.length)}>❮</button> | ||
<button className="carousel-control next" onClick={() => setCurrentSlide((currentSlide + 1) % slides.length)}>❯</button> | ||
))} | ||
</div> | ||
<button className="carousel-control prev" onClick={() => setCurrentSlide((currentSlide - 1 + slides.length) % slides.length)}>❮</button> | ||
<button className="carousel-control next" onClick={() => setCurrentSlide((currentSlide + 1) % slides.length)}>❯</button> | ||
</div> | ||
); | ||
}; | ||
|
||
// Imagen debajo del carrusel | ||
const ImageBelowCarousel = () => { | ||
const imgindx = require('./imagenes/imgindx.png'); | ||
|
||
return ( | ||
<img src={imgindx} alt="Imagen debajo del carousel" className="imagen-debajo-carousel" /> | ||
<img src={imgindx} alt="Imagen debajo del carousel" className="imagen-debajo-carousel" /> | ||
); | ||
}; | ||
|
||
// Definimos el Footer | ||
const Footer = () => { | ||
return ( | ||
<footer className="footer"> | ||
<div className="container"> | ||
<p>© 2024 HBB Hamburguesas Bogotá</p> | ||
<ul className="footer-links"> | ||
<li><a href="#">Acerca de nosotros</a></li> | ||
<li><a href="#">Contacto</a></li> | ||
<li><a href="#">Política de privacidad</a></li> | ||
</ul> | ||
</div> | ||
</footer> | ||
); | ||
return ( | ||
<footer className="footer"> | ||
<div className="container"> | ||
<p>© 2024 HBB Hamburguesas Bogotá</p> | ||
<ul className="footer-links"> | ||
<li><a href="#">Acerca de nosotros</a></li> | ||
<li><a href="#">Contacto</a></li> | ||
<li><a href="#">Política de privacidad</a></li> | ||
</ul> | ||
</div> | ||
</footer> | ||
); | ||
}; | ||
|
||
// Componente para la página de inicio | ||
const Home = () => { | ||
return ( | ||
<> | ||
<Carousel /> | ||
<ImageBelowCarousel /> | ||
</> | ||
); | ||
}; | ||
|
||
// Componente para la página del menú | ||
const Menu = () => { | ||
return ( | ||
<div> | ||
<h1>Menú</h1> | ||
<p>Bienvenido al menú de nuestras deliciosas hamburguesas.</p> | ||
{/* Aquí puedes agregar el contenido específico del menú */} | ||
</div> | ||
); | ||
}; | ||
|
||
// Componente principal App | ||
const App = () => { | ||
return ( | ||
<Router> | ||
<div className="App"> | ||
<Navbar /> | ||
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/menu" element={<Menu />} /> | ||
</Routes> | ||
<Footer /> | ||
</div> | ||
</Router> | ||
); | ||
}; | ||
|
||
export default Navbar; | ||
export default App; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import './App.css'; | ||
|
||
// Definimos el componente Navbar | ||
const Navbar = () => { | ||
const handleLinkClick = (url, e) => { | ||
e.preventDefault(); | ||
window.open(url, "_blank"); // Abre la página en una nueva pestaña | ||
}; | ||
|
||
return ( | ||
<nav className="navbar"> | ||
<img src={require('./imagenes/logo.png')} alt="Logo" className="logo" /> | ||
<ul className="nav-links"> | ||
<li> | ||
<a href="#promociones" onClick={(e) => handleLinkClick('/promociones', e)}> | ||
Promociones | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#menu" onClick={(e) => handleLinkClick('/menu', e)}> | ||
Menú | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#combos" onClick={(e) => handleLinkClick('/combos', e)}> | ||
Combos | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default Navbar; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,15 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import React from 'react'; | ||
import './App.css'; | ||
|
||
|
||
const Navbar = () => { | ||
const handleLinkClick = (url, e) => { | ||
e.preventDefault(); | ||
window.open(url, "_blank"); // Abre la página en una nueva pestaña | ||
}; | ||
|
||
return ( | ||
<> | ||
<nav className="navbar"> | ||
<img src={require('./imagenes/logo.png')} alt="Logo" className="logo" /> | ||
<ul className="nav-links"> | ||
<li> | ||
<a href="#promociones" onClick={(e) => handleLinkClick('/promociones', e)}> | ||
Promociones | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#menu" onClick={(e) => handleLinkClick('/menu', e)}> | ||
Menú | ||
</a> | ||
</li> | ||
<li> | ||
<a href="#combos" onClick={(e) => handleLinkClick('/combos', e)}> | ||
Combos | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
<Carousel /> | ||
<ImageBelowCarousel /> | ||
<Footer /> | ||
</> | ||
); | ||
}; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const Footer = () => { | ||
return ( | ||
<footer className="footer"> | ||
<div className="container"> | ||
<p>© 2024 HBB Hamburguesas Bogotá</p> | ||
<ul className="footer-links"> | ||
<li><a href="#">Acerca de nosotros</a></li> | ||
<li><a href="#">Contacto</a></li> | ||
<li><a href="#">Política de privacidad</a></li> | ||
</ul> | ||
</div> | ||
</footer> | ||
); | ||
// Componente para la página del menú | ||
const Menu = () => { | ||
return ( | ||
<div className="menu"> | ||
<h1>Menú</h1> | ||
<p>Bienvenido al menú de nuestras deliciosas hamburguesas.</p> | ||
{/* Aquí puedes agregar el contenido específico del menú */} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Navbar; | ||
export default Menu; |