-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from gisachris/development
Development
- Loading branch information
Showing
14 changed files
with
488 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,43 @@ | ||
import { useState, useRef, useEffect } from 'react'; | ||
import '../../styles/css/aniText.css'; | ||
|
||
const AnimatedText = () => { | ||
const titles = ['Web Developer', 'Api Developer', 'Backend Engineer', 'FrontEnd Developer', 'Rails Enthusiast', 'Rails Developer', 'Web Enthusiast', 'FullStack Developer']; | ||
const textHolderRef = useRef(); | ||
const textRef = useRef(); | ||
const [index, setIndex] = useState(0); | ||
const [text1, setText1] = useState(titles[0]); | ||
|
||
useEffect(() => { | ||
const locations = ['top', 'right', 'bottom', 'left']; | ||
const currentLocation = locations[Math.floor(Math.random() * 4)]; | ||
|
||
if (index < titles.length) { | ||
setText1(titles[index]); | ||
textHolderRef.current.classList.add(`style-border-${currentLocation}`); | ||
textRef.current.classList.add(`drop-text-from-${currentLocation}`); | ||
|
||
setTimeout(() => { | ||
textHolderRef.current.classList.remove(`style-border-${currentLocation}`); | ||
textRef.current.classList.remove(`drop-text-from-${currentLocation}`); | ||
setIndex((prevIndex) => prevIndex + 1); | ||
}, 3500); | ||
} | ||
|
||
if(index === titles.length - 1){ | ||
setText1(titles[index]); | ||
textHolderRef.current.classList.add('holderStay'); | ||
textRef.current.classList.add('textStay'); | ||
} | ||
}, [index]); | ||
|
||
return ( | ||
<div className={`animatedTextHolder`} ref={textHolderRef}> | ||
<span className={`textFirst`} ref={textRef}> | ||
{text1} | ||
</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default AnimatedText; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.