2024-10-10 17:03:42 -05:00
|
|
|
import React, { useEffect, useState, useRef } from 'react';
|
2024-09-09 17:35:00 -05:00
|
|
|
import useWindowWidth from '@/hooks/useWindowWidth';
|
2024-03-17 17:32:23 -05:00
|
|
|
import Image from 'next/image';
|
2024-10-10 17:03:42 -05:00
|
|
|
import { useImageProxy } from '@/hooks/useImageProxy';
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
import GenericButton from '../buttons/GenericButton';
|
|
|
|
import HeroImage from '../../../public/images/hero-image.png';
|
2024-03-17 17:32:23 -05:00
|
|
|
|
|
|
|
const HeroBanner = () => {
|
2024-10-10 17:03:42 -05:00
|
|
|
const [currentTech, setCurrentTech] = useState('Bitcoin');
|
|
|
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
|
|
const techs = ['Bitcoin', 'Lightning', 'Nostr'];
|
2024-09-09 17:35:00 -05:00
|
|
|
const windowWidth = useWindowWidth();
|
2024-10-10 17:03:42 -05:00
|
|
|
const isTabView = windowWidth <= 1360;
|
|
|
|
const router = useRouter();
|
|
|
|
const { returnImageProxy } = useImageProxy();
|
|
|
|
const videoRef = useRef(null);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
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);
|
|
|
|
}, []);
|
2024-09-09 17:35:00 -05:00
|
|
|
|
2024-10-10 17:03:42 -05:00
|
|
|
const getColorClass = (tech) => {
|
|
|
|
switch (tech) {
|
2024-03-19 17:47:16 -05:00
|
|
|
case 'Bitcoin': return 'text-orange-400';
|
|
|
|
case 'Lightning': return 'text-blue-500';
|
|
|
|
case 'Nostr': return 'text-purple-400';
|
|
|
|
default: return 'text-white';
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-10-10 17:03:42 -05:00
|
|
|
// useEffect(() => {
|
|
|
|
// videoRef.current.play();
|
|
|
|
// }, []);
|
2024-03-17 17:32:23 -05:00
|
|
|
|
|
|
|
return (
|
2024-10-10 17:03:42 -05:00
|
|
|
<div className="h-[450px] relative flex justify-center items-center overflow-hidden">
|
|
|
|
<Image
|
2024-10-10 17:07:12 -05:00
|
|
|
src={returnImageProxy("https://media.istockphoto.com/id/1224500457/photo/programming-code-abstract-technology-background-of-software-developer-and-computer-script.jpg?s=612x612&w=0&k=20&c=nHMypkMTU1HUUW85Zt0Ff7MDbq17n0eVeXaoM9Knt4Q=")}
|
2024-10-10 17:03:42 -05:00
|
|
|
alt="Banner"
|
|
|
|
quality={100}
|
|
|
|
fill
|
|
|
|
style={{ objectFit: 'cover' }}
|
|
|
|
className='opacity-100'
|
|
|
|
/>
|
|
|
|
{/* <video
|
|
|
|
src={"https://plebdevs-bucket.nyc3.cdn.digitaloceanspaces.com/plebdevs-montage.mp4"}
|
|
|
|
className={`object-cover w-full h-[450px] rounded-lg rounded-tr-none rounded-br-none`}
|
|
|
|
ref={videoRef}
|
|
|
|
loop
|
|
|
|
muted
|
|
|
|
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
|
2024-03-17 17:32:23 -05:00
|
|
|
</span>
|
2024-10-10 17:03:42 -05:00
|
|
|
<span className="block">Become a dev</span>
|
|
|
|
</h1>
|
|
|
|
<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>
|
2024-03-17 17:32:23 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default HeroBanner;
|