mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Trying more simple hero banner
This commit is contained in:
parent
5fc05283ad
commit
37bc364efd
BIN
public/images/hero-image.png
Normal file
BIN
public/images/hero-image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 630 KiB |
@ -1,16 +1,38 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState, useRef } from 'react';
|
||||||
import useWindowWidth from '@/hooks/useWindowWidth';
|
import useWindowWidth from '@/hooks/useWindowWidth';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
import { useImageProxy } from '@/hooks/useImageProxy';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
import GenericButton from '../buttons/GenericButton';
|
||||||
|
import HeroImage from '../../../public/images/hero-image.png';
|
||||||
|
|
||||||
const HeroBanner = () => {
|
const HeroBanner = () => {
|
||||||
const options = ['Bitcoin', 'Lightning', 'Nostr'];
|
const [currentTech, setCurrentTech] = useState('Bitcoin');
|
||||||
const [currentOption, setCurrentOption] = useState(0);
|
const [isAnimating, setIsAnimating] = useState(false);
|
||||||
const [isFlipping, setIsFlipping] = useState(false);
|
const techs = ['Bitcoin', 'Lightning', 'Nostr'];
|
||||||
|
|
||||||
const windowWidth = useWindowWidth();
|
const windowWidth = useWindowWidth();
|
||||||
|
const isTabView = windowWidth <= 1360;
|
||||||
|
const router = useRouter();
|
||||||
|
const { returnImageProxy } = useImageProxy();
|
||||||
|
const videoRef = useRef(null);
|
||||||
|
|
||||||
const getColorClass = (option) => {
|
useEffect(() => {
|
||||||
switch (option) {
|
const interval = setInterval(() => {
|
||||||
|
setIsAnimating(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setCurrentTech(prev => {
|
||||||
|
const currentIndex = techs.indexOf(prev);
|
||||||
|
return techs[(currentIndex + 1) % techs.length];
|
||||||
|
});
|
||||||
|
setIsAnimating(false);
|
||||||
|
}, 400); // Half of the interval for smooth transition
|
||||||
|
}, 2800);
|
||||||
|
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const getColorClass = (tech) => {
|
||||||
|
switch (tech) {
|
||||||
case 'Bitcoin': return 'text-orange-400';
|
case 'Bitcoin': return 'text-orange-400';
|
||||||
case 'Lightning': return 'text-blue-500';
|
case 'Lightning': return 'text-blue-500';
|
||||||
case 'Nostr': return 'text-purple-400';
|
case 'Nostr': return 'text-purple-400';
|
||||||
@ -18,44 +40,61 @@ const HeroBanner = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
const interval = setInterval(() => {
|
// videoRef.current.play();
|
||||||
setIsFlipping(true);
|
// }, []);
|
||||||
setTimeout(() => {
|
|
||||||
setCurrentOption((prevOption) => (prevOption + 1) % options.length);
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsFlipping(false);
|
|
||||||
}, 400); // Start preparing to flip back a bit before the halfway point
|
|
||||||
}, 400); // Update slightly before the midpoint for smoother transition
|
|
||||||
}, 2500); // Increased to provide a slight pause between animations for readability
|
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex justify-center items-center">
|
<div className="h-[450px] relative flex justify-center items-center overflow-hidden">
|
||||||
{windowWidth && (
|
|
||||||
<Image
|
<Image
|
||||||
src="/images/plebdevs-banner.png"
|
src={HeroImage}
|
||||||
alt="Banner"
|
alt="Banner"
|
||||||
width={windowWidth <= 1920 ? 1920 : windowWidth}
|
|
||||||
height={1080}
|
|
||||||
quality={100}
|
quality={100}
|
||||||
className='opacity-70'
|
fill
|
||||||
|
style={{ objectFit: 'cover' }}
|
||||||
|
className='opacity-100'
|
||||||
/>
|
/>
|
||||||
)}
|
{/* <video
|
||||||
<div className="w-[75vw] sm:w-[65vw] md:w-[45vw] lg:w-[45vw] xl:w-[37vw] absolute text-center text-white text-xl h-full flex flex-col justify-evenly">
|
src={"https://plebdevs-bucket.nyc3.cdn.digitaloceanspaces.com/plebdevs-montage.mp4"}
|
||||||
<p className='text-2xl md:text-4xl lg:text-5xl xl:text-5xl'>Learn how to code</p>
|
className={`object-cover w-full h-[450px] rounded-lg rounded-tr-none rounded-br-none`}
|
||||||
<p className='text-2xl md:text-4xl lg:text-5xl xl:text-5xl'>
|
ref={videoRef}
|
||||||
Build{' '}
|
loop
|
||||||
<span className={`inline-block w-[50%] ${isFlipping ? 'flip-enter-active' : ''} ${getColorClass(options[currentOption])}`}>
|
muted
|
||||||
{options[currentOption]}
|
playsInline
|
||||||
|
/> */}
|
||||||
|
<div className="absolute inset-0 bg-gradient-to-br from-black via-black/40 to-transparent rounded-lg" />
|
||||||
|
<div className={`absolute inset-0 flex flex-col justify-center ${isTabView ? 'items-center text-center' : 'items-start pl-12'}`}>
|
||||||
|
<h1 className={`text-4xl sm:text-5xl lg:text-6xl font-bold leading-tight mb-6 ${isTabView ? 'px-4' : ''}`}>
|
||||||
|
<span className="block">Learn to code</span>
|
||||||
|
<span className={`block ${getColorClass(currentTech)} transition-opacity duration-500 ${isAnimating ? 'opacity-0' : 'opacity-100'}`}>
|
||||||
|
Build {currentTech} apps
|
||||||
</span>
|
</span>
|
||||||
{' '}Apps
|
<span className="block">Become a dev</span>
|
||||||
</p>
|
</h1>
|
||||||
<p className='text-2xl md:text-4xl lg:text-5xl xl:text-5xl'>Become a developer</p>
|
<h2 className="text-2xl text-[#f8f8ff] mb-8 font-semibold">
|
||||||
|
A one of a kind developer education and community platform built on Nostr and fully Lightning integrated.
|
||||||
|
</h2>
|
||||||
|
<div className="space-x-4">
|
||||||
|
<GenericButton
|
||||||
|
label="Learn"
|
||||||
|
icon="pi pi-book"
|
||||||
|
rounded
|
||||||
|
severity="info"
|
||||||
|
size="large"
|
||||||
|
outlined
|
||||||
|
onClick={() => router.push('/content?tag=all')}
|
||||||
|
/>
|
||||||
|
<GenericButton
|
||||||
|
label="Connect"
|
||||||
|
icon="pi pi-users"
|
||||||
|
rounded
|
||||||
|
size="large"
|
||||||
|
severity="success"
|
||||||
|
outlined
|
||||||
|
onClick={() => router.push('/feed?channel=global')}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@ import CoursesCarousel from '@/components/content/carousels/CoursesCarousel';
|
|||||||
import VideosCarousel from '@/components/content/carousels/VideosCarousel';
|
import VideosCarousel from '@/components/content/carousels/VideosCarousel';
|
||||||
import DocumentsCarousel from '@/components/content/carousels/DocumentsCarousel';
|
import DocumentsCarousel from '@/components/content/carousels/DocumentsCarousel';
|
||||||
import InteractivePromotionalCarousel from '@/components/content/carousels/InteractivePromotionalCarousel';
|
import InteractivePromotionalCarousel from '@/components/content/carousels/InteractivePromotionalCarousel';
|
||||||
|
import HeroBanner from '@/components/banner/HeroBanner';
|
||||||
|
|
||||||
// todo: make paid course video and document lessons not appear in carousels
|
// todo: make paid course video and document lessons not appear in carousels
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
@ -16,7 +17,8 @@ export default function Home() {
|
|||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
</Head>
|
</Head>
|
||||||
<main>
|
<main>
|
||||||
<InteractivePromotionalCarousel />
|
{/* <InteractivePromotionalCarousel /> */}
|
||||||
|
<HeroBanner />
|
||||||
<CoursesCarousel />
|
<CoursesCarousel />
|
||||||
<VideosCarousel />
|
<VideosCarousel />
|
||||||
<DocumentsCarousel />
|
<DocumentsCarousel />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user