-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
13 changed files
with
172 additions
and
58 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
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,5 +1,5 @@ | ||
--- | ||
title: Form builder | ||
title: React Form Builder | ||
nextjs: | ||
metadata: | ||
title: React form builder | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"use client"; | ||
|
||
import { useEffect, useState } from "react"; | ||
import { cn } from "@/lib/utils"; | ||
import { AnimatePresence, motion, type HTMLMotionProps } from "framer-motion"; | ||
|
||
interface WordRotateProps { | ||
words: string[]; | ||
duration?: number; | ||
framerProps?: HTMLMotionProps<"h1">; | ||
className?: string; | ||
} | ||
|
||
export function WordRotate({ | ||
words, | ||
duration = 2000, | ||
framerProps = { | ||
initial: { opacity: 0, y: -5 }, | ||
animate: { opacity: 1, y: 0 }, | ||
exit: { opacity: 0, y: 5 }, | ||
transition: { duration: 0.25, ease: "easeOut" }, | ||
}, | ||
className, | ||
}: WordRotateProps) { | ||
const [index, setIndex] = useState(0); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setIndex((prevIndex) => (prevIndex + 1) % words.length); | ||
}, duration); | ||
|
||
return () => clearInterval(interval); | ||
}, [words, duration]); | ||
|
||
return ( | ||
<span className="overflow-hidden py-2"> | ||
<AnimatePresence mode="wait"> | ||
<motion.span | ||
key={words[index]} | ||
className={cn("inline-block", className)} | ||
{...framerProps} | ||
> | ||
{words[index]} | ||
</motion.span> | ||
</AnimatePresence> | ||
</span> | ||
); | ||
} |
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
Oops, something went wrong.