feat: use gloweffect

This commit is contained in:
Oleg Proskurin 2025-12-04 13:12:16 +07:00
parent d688c5890a
commit 7f37a5667b
2 changed files with 22 additions and 38 deletions

View File

@ -1,7 +1,6 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
export default function EmailFormDemo() { export default function GlowEffect({children}) {
const [email, setEmail] = useState('');
const [isPropertyRegistered, setIsPropertyRegistered] = useState(false); const [isPropertyRegistered, setIsPropertyRegistered] = useState(false);
// Register CSS property in component body (before render) // Register CSS property in component body (before render)
@ -23,11 +22,6 @@ export default function EmailFormDemo() {
setIsPropertyRegistered(true); setIsPropertyRegistered(true);
}, []); }, []);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
alert(`Email submitted: ${email}`);
};
return ( return (
<> <>
{isPropertyRegistered && ( {isPropertyRegistered && (
@ -43,11 +37,13 @@ export default function EmailFormDemo() {
conic-gradient(from var(--form-angle, 0deg), conic-gradient(from var(--form-angle, 0deg),
rgba(99, 102, 241, 0.5), rgba(99, 102, 241, 0.5),
rgba(139, 92, 246, 1), rgba(139, 92, 246, 1),
rgba(99, 102, 241, 0.5),
rgba(236, 72, 153, 0.8), rgba(236, 72, 153, 0.8),
rgba(99, 102, 241, 0.5),
rgba(34, 211, 238, 1), rgba(34, 211, 238, 1),
rgba(99, 102, 241, 0.5) rgba(99, 102, 241, 0.5)
) border-box; ) border-box;
animation: form-glow-rotate 4s linear infinite; animation: form-glow-rotate 12s linear infinite;
} }
.email-form-wrapper::before { .email-form-wrapper::before {
@ -58,39 +54,23 @@ export default function EmailFormDemo() {
background: conic-gradient(from var(--form-angle, 0deg), background: conic-gradient(from var(--form-angle, 0deg),
rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.2),
rgba(139, 92, 246, 0.7), rgba(139, 92, 246, 0.7),
rgba(99, 102, 241, 0.2),
rgba(236, 72, 153, 0.5), rgba(236, 72, 153, 0.5),
rgba(99, 102, 241, 0.2),
rgba(34, 211, 238, 0.7), rgba(34, 211, 238, 0.7),
rgba(99, 102, 241, 0.2) rgba(99, 102, 241, 0.2)
); );
filter: blur(20px); filter: blur(18px);
opacity: 0.8; opacity: 0.75;
z-index: -1; z-index: -1;
animation: form-glow-rotate 4s linear infinite; animation: form-glow-rotate 12s linear infinite;
} }
`}</style> `}</style>
)} )}
<div className="h-60 flex items-center justify-center p-4"> <div className="flex items-center justify-center p-4">
<div className="email-form-wrapper relative isolate max-w-md w-full mx-auto p-[2px] rounded-xl"> <div className="email-form-wrapper relative isolate max-w-lg w-full mx-auto p-[2px] rounded-xl">
<form {children}
onSubmit={handleSubmit}
className="flex flex-col sm:flex-row gap-2 rounded-[10px] p-1.5 sm:pl-3"
style={{ background: 'rgba(10, 6, 18, 0.95)' }}
>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="your@email.com"
className="flex-1 px-4 py-3 bg-transparent border-none rounded-md text-white outline-none placeholder:text-white/40 focus:bg-white/[0.03]"
/>
<button
type="submit"
className="px-6 py-3 bg-gradient-to-br from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 rounded-md text-white font-semibold cursor-pointer transition-all whitespace-nowrap"
>
Get Early Access
</button>
</form>
</div> </div>
</div> </div>
</> </>

View File

@ -35,7 +35,7 @@ import {
Award, Award,
ArrowRight, ArrowRight,
} from 'lucide-react'; } from 'lucide-react';
import EmailFormDemo from './_components/Emailformanimated'; import GlowEffect from './_components/GlowEffect';
// ============================================================================ // ============================================================================
// STYLES (CSS-in-JS for custom styles not available in Tailwind) // STYLES (CSS-in-JS for custom styles not available in Tailwind)
@ -189,8 +189,12 @@ function HeroSection() {
</p> </p>
{/* Email Form */} {/* Email Form */}
<div className="email-form-wrapper mb-4"> <GlowEffect>
<form onSubmit={handleSubmit} className="flex flex-col sm:flex-row gap-2 bg-[rgba(10,6,18,0.95)] rounded-[10px] p-1.5 sm:p-1.5 sm:pl-3"> <form
onSubmit={handleSubmit}
className="flex flex-col sm:flex-row gap-2 rounded-[10px] p-1.5 sm:pl-3"
style={{ background: 'rgba(10, 6, 18, 0.95)' }}
>
<input <input
type="email" type="email"
value={email} value={email}
@ -200,16 +204,16 @@ function HeroSection() {
/> />
<button <button
type="submit" type="submit"
className="px-6 py-3 bg-gradient-to-br from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 border-none rounded-md text-white font-semibold cursor-pointer transition-all whitespace-nowrap" className="px-6 py-3 bg-gradient-to-br from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 rounded-md text-white font-semibold cursor-pointer transition-all whitespace-nowrap"
> >
Get Early Access Get Early Access
</button> </button>
</form> </form>
</div> </GlowEffect>
<p className="text-sm text-gray-500 mb-10">Free early access. No credit card required.</p> <p className="text-sm text-gray-500 mb-10">Free early access. No credit card required.</p>
<EmailFormDemo />
{/* Badges */} {/* Badges */}
<div className="flex flex-nowrap gap-5 justify-center"> <div className="flex flex-nowrap gap-5 justify-center">