diff --git a/src/components/stateless/ColorfulText/index.jsx b/src/components/stateless/ColorfulText/index.jsx new file mode 100644 index 00000000..9fea54ca --- /dev/null +++ b/src/components/stateless/ColorfulText/index.jsx @@ -0,0 +1,55 @@ +import React from 'react' +import { motion } from 'motion/react' + +const ColorfulText = ({ text }) => { + const colors = [ + 'rgb(131, 179, 32)', + 'rgb(47, 195, 106)', + 'rgb(42, 169, 210)', + 'rgb(4, 112, 202)', + 'rgb(107, 10, 255)', + 'rgb(183, 0, 218)', + 'rgb(218, 0, 171)', + 'rgb(230, 64, 92)', + 'rgb(232, 98, 63)', + 'rgb(249, 129, 47)', + ] + + const [currentColors, setCurrentColors] = React.useState(colors) + const [count, setCount] = React.useState(0) + + React.useEffect(() => { + const interval = setInterval(() => { + const shuffled = [...colors].sort(() => Math.random() - 0.5) + setCurrentColors(shuffled) + setCount((prev) => prev + 1) + }, 5000) + + return () => clearInterval(interval) + }, []) + + return text.split('').map((char, index) => ( + + {char} + + )) +} + +export default ColorfulText diff --git a/src/components/stateless/MemoizedStars/index.jsx b/src/components/stateless/MemoizedStars/index.jsx new file mode 100644 index 00000000..ae868ceb --- /dev/null +++ b/src/components/stateless/MemoizedStars/index.jsx @@ -0,0 +1,43 @@ +import React, { memo } from 'react' +import { motion } from 'motion/react' + +const Stars = () => { + const randomMove = () => Math.random() * 4 - 2 + const randomOpacity = () => Math.random() + const random = () => Math.random() + return ( +
+ {[...Array(80)].map((_, i) => ( + + ))} +
+ ) +} + +const MemoizedStars = memo(Stars) + +export default MemoizedStars diff --git a/src/pages/home/index.jsx b/src/pages/home/index.jsx index d4d0c631..33581a4b 100644 --- a/src/pages/home/index.jsx +++ b/src/pages/home/index.jsx @@ -51,6 +51,8 @@ import TypeWriter from '@stateless/TypeWriter' import SlideText from '@stateless/SlideText' import SparklesCore from '@stateless/Sparkles' import SparklesText from '@stateless/SparklesText' +import ColorfulText from '@stateless/ColorfulText' +import MemoizedStars from '@stateless/MemoizedStars' import firstImage from '@assets/images/88-300x160.jpg' import secondImage from '@assets/images/2-300x160.jpg' @@ -270,7 +272,7 @@ const Home = () => { return (
- React version: {version} +
@@ -360,6 +362,19 @@ const Home = () => { >
+
+ +