-
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
xtian7489
committed
Mar 19, 2024
1 parent
6b3ec04
commit 2bedda4
Showing
5 changed files
with
104 additions
and
26 deletions.
There are no files selected for viewing
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
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,19 +1,38 @@ | ||
import Link from "next/link" | ||
import Logo from "./logo" | ||
import ImageRandom from "./image-random"; | ||
|
||
const BannerTitle = ({ urlAction, title, subtitle, image, linkButton, textButton }) => { | ||
return (<div className='hero is-fullheight banner-title is-flex is-justify-content-center is-align-items-flex-start is-flex-direction-column is-relative pt-0' | ||
style={{ backgroundImage: `url('${image}')` }}> | ||
<div className="is-overlay"></div> | ||
<div className="content"> | ||
<img src="/images/logoSimple.svg" alt="" /> | ||
<div className="my-3"> | ||
<p className=' title has-text-brown-dark is-uppercase has-text-weight-bold mb-3 is-size-1 is-size-3-touch'>{title}</p> | ||
<p className="has-text-weight-light has-text-brown-dark has-text-weight-bold is-size-4 is-size-5-touch">{subtitle}</p> | ||
</div> | ||
</div> | ||
{textButton && linkButton && <Link href={linkButton} className="button is-white is-rounded px-6 is-uppercase">{textButton}</Link>} | ||
</div>) | ||
} | ||
const BannerTitle = ({ | ||
urlAction, | ||
title, | ||
subtitle, | ||
linkButton, | ||
textButton, | ||
}) => { | ||
return ( | ||
<div className="hero is-fullheight banner-title is-flex is-justify-content-center is-align-items-flex-start is-flex-direction-column is-relative pt-0 pb-4"> | ||
<ImageRandom /> | ||
<div className="is-overlay"></div> | ||
<div className="content"> | ||
<img src="/images/logoSimple.svg" alt="" /> | ||
<div className="my-3"> | ||
<h1 className=" title has-text-brown-dark is-uppercase has-text-weight-bold mb-3 is-size-1 is-size-3-touch"> | ||
{title} | ||
</h1> | ||
<h2 className="has-text-weight-light has-text-brown-dark has-text-weight-bold is-size-4 is-size-5-touch"> | ||
{subtitle} | ||
</h2> | ||
</div> | ||
</div> | ||
{textButton && linkButton && ( | ||
<Link | ||
href={linkButton} | ||
className="button is-white is-rounded px-6 is-uppercase" | ||
> | ||
{textButton} | ||
</Link> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BannerTitle |
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,47 @@ | ||
"use client"; | ||
import { useEffect, useState } from "react"; | ||
import Link from "next/link"; | ||
|
||
import Logo from "./logo"; | ||
import { BANNER_BACKGROUND } from "@/utils/constants"; | ||
import Image from "next/image"; | ||
|
||
const ImageRandom = ({ | ||
urlAction, | ||
title, | ||
subtitle, | ||
linkButton, | ||
textButton, | ||
}) => { | ||
const [imageActive, setImageActive] = useState(0); | ||
|
||
const getRandomBackground = () => { | ||
setInterval(() => { | ||
var randomNumber = Math.random(); | ||
const index = Math.floor(BANNER_BACKGROUND.length * randomNumber); | ||
setImageActive(index); | ||
}, 5000); | ||
}; | ||
useEffect(() => { | ||
getRandomBackground(); | ||
}, []); | ||
return ( | ||
<div> | ||
{BANNER_BACKGROUND.map((image, idx) => ( | ||
<Image | ||
key={idx} | ||
src={`/images/banners/${image}`} | ||
alt="imagen país" | ||
width={0} | ||
height={0} | ||
sizes="100vw" | ||
className={`banner-background ${ | ||
idx === imageActive ? "active" : "" | ||
}`} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ImageRandom; |
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