File tree Expand file tree Collapse file tree 1 file changed +0
-72
lines changed
Expand file tree Collapse file tree 1 file changed +0
-72
lines changed Original file line number Diff line number Diff line change @@ -86,76 +86,4 @@ const TypewriterEffect = ({
8686 ) ;
8787} ;
8888
89- export const TypewriterEffectSmooth = memo ( ( {
90- words,
91- className,
92- cursorClassName,
93- } : {
94- words : {
95- text : string ;
96- className ?: string ;
97- } [ ] ;
98- className ?: string ;
99- cursorClassName ?: string ;
100- } ) => {
101- const wordsArray = useMemo ( ( ) => words . map ( ( word ) => ( {
102- ...word ,
103- text : word . text . split ( "" ) ,
104- } ) ) , [ words ] ) ;
105-
106- const renderWords = useCallback ( ( ) => (
107- < div >
108- { wordsArray . map ( ( word , idx ) => (
109- < div key = { `word-${ idx } ` } className = "inline-block" >
110- { word . text . map ( ( char , index ) => (
111- < span
112- key = { `char-${ index } ` }
113- className = { cn ( `text-white` , word . className ) }
114- >
115- { char }
116- </ span >
117- ) ) }
118-
119- </ div >
120- ) ) }
121- </ div >
122- ) , [ wordsArray ] ) ;
123-
124- return (
125- < div className = { cn ( "flex space-x-1 my-6" , className ) } >
126- < motion . div
127- className = "overflow-hidden pb-2"
128- initial = { { width : "0%" } }
129- whileInView = { { width : "fit-content" } }
130- viewport = { { once : true } }
131- transition = { {
132- duration : 2 ,
133- ease : "linear" ,
134- delay : 1 ,
135- } }
136- >
137- < div
138- className = "text-xs sm:text-base md:text-xl lg:text:3xl xl:text-5xl font-bold"
139- style = { { whiteSpace : "nowrap" } }
140- >
141- { renderWords ( ) }
142- </ div >
143- </ motion . div >
144- < motion . span
145- initial = { { opacity : 0 } }
146- animate = { { opacity : 1 } }
147- transition = { {
148- duration : 0.8 ,
149- repeat : Infinity ,
150- repeatType : "reverse" ,
151- } }
152- className = { cn (
153- "block rounded-sm w-[4px] h-5 sm:h-6 xl:h-12 bg-blue-500" ,
154- cursorClassName
155- ) }
156- />
157- </ div >
158- ) ;
159- } ) ;
160-
16189export default memo ( TypewriterEffect ) ;
You can’t perform that action at this time.
0 commit comments