diff --git a/app/page.tsx b/app/page.tsx
index c66eab0..775ec3d 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -7,6 +7,9 @@ import { Input } from '@/components/ui/input';
import FeaturedEvent from '@/components/custom/FeaturedEvent';
import { Button } from '@/components/ui/button';
+import React from 'react';
+import { FlipWords } from '@/components/ui/flip-words';
+
export default function Home() {
const router = useRouter();
const [isClient, setIsClient] = useState(false);
@@ -17,10 +20,19 @@ export default function Home() {
}, []);
function searchForEvents() {
- if (inputRef.current.value == "") return;
- router.replace("/events?q=" + encodeURIComponent(inputRef.current.value));
+ if (inputRef.current.value == '') return;
+ router.replace('/events?q=' + encodeURIComponent(inputRef.current.value));
}
+ const words = [
+ 'adventure',
+ 'concert',
+ 'outing',
+ 'journey',
+ 'hackathon',
+ 'conference',
+ ];
+
return (
<>
@@ -44,9 +56,17 @@ export default function Home() {
{/* Page Content Over the Video */}
-
- Book your next adventure
on the Flare blockchain
-
+
+
+ Book your next
+
+ on the Flare blockchain.
+
+
+
Search for events
+ >
+ Search for events
+
@@ -67,7 +89,9 @@ export default function Home() {
location="Birmingham, UK"
eventStartDate={1729980000}
eventHost="0x225C73C8c536C4F5335a2C1abECa95b0f221eeF6"
- imageURL={"https://www.guildofstudents.com/asset/Event/7572/Halloween-Fab-XO-Web-Event.jpg"}
+ imageURL={
+ 'https://www.guildofstudents.com/asset/Event/7572/Halloween-Fab-XO-Web-Event.jpg'
+ }
/>
@@ -93,4 +121,4 @@ export default function Home() {
>
);
-}
\ No newline at end of file
+}
diff --git a/components/ui/flip-words.tsx b/components/ui/flip-words.tsx
new file mode 100644
index 0000000..20f74d1
--- /dev/null
+++ b/components/ui/flip-words.tsx
@@ -0,0 +1,98 @@
+'use client';
+import React, { useCallback, useEffect, useState } from 'react';
+import { AnimatePresence, motion } from 'framer-motion';
+import { cn } from '@/lib/utils';
+
+export const FlipWords = ({
+ words,
+ duration = 3000,
+ className,
+}: {
+ words: string[];
+ duration?: number;
+ className?: string;
+}) => {
+ const [currentWord, setCurrentWord] = useState(words[0]);
+ const [isAnimating, setIsAnimating] = useState
(false);
+
+ // thanks for the fix Julian - https://github.com/Julian-AT
+ const startAnimation = useCallback(() => {
+ const word = words[words.indexOf(currentWord) + 1] || words[0];
+ setCurrentWord(word);
+ setIsAnimating(true);
+ }, [currentWord, words]);
+
+ useEffect(() => {
+ if (!isAnimating)
+ setTimeout(() => {
+ startAnimation();
+ }, duration);
+ }, [isAnimating, duration, startAnimation]);
+
+ return (
+ {
+ setIsAnimating(false);
+ }}
+ >
+
+ {/* edit suggested by Sajal: https://x.com/DewanganSajal */}
+ {currentWord.split(' ').map((word, wordIndex) => (
+
+ {word.split('').map((letter, letterIndex) => (
+
+ {letter}
+
+ ))}
+
+
+ ))}
+
+
+ );
+};