Skip to content

Commit 44ca85d

Browse files
committed
fix(): Fixing minor issues
1 parent 5102ab2 commit 44ca85d

6 files changed

Lines changed: 86 additions & 19 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { useEffect } from 'react';
2+
import { motion, stagger, useAnimate } from 'framer-motion';
3+
import { Text } from '@chakra-ui/react';
4+
5+
const TextGenerateEffect = ({
6+
words,
7+
className,
8+
filter = true,
9+
duration = 0.5,
10+
}: {
11+
words: string;
12+
className?: string;
13+
filter?: boolean;
14+
duration?: number;
15+
}) => {
16+
const [scope, animate] = useAnimate();
17+
const wordsArray = words.split(' ');
18+
useEffect(() => {
19+
animate(
20+
'span',
21+
{
22+
opacity: 1,
23+
filter: filter ? 'blur(0px)' : 'none',
24+
},
25+
{
26+
duration: duration ? duration : 1,
27+
delay: stagger(0.2),
28+
},
29+
);
30+
}, [animate, duration, filter]);
31+
32+
const renderWords = () => {
33+
return (
34+
<motion.div ref={scope}>
35+
{wordsArray.map((word, idx) => {
36+
return (
37+
<motion.span
38+
key={word + idx}
39+
className="dark:text-white text-black opacity-0"
40+
style={{
41+
filter: filter ? 'blur(10px)' : 'none',
42+
}}
43+
>
44+
{word}{' '}
45+
</motion.span>
46+
);
47+
})}
48+
</motion.div>
49+
);
50+
};
51+
52+
return (
53+
<div className={'font-bold ' + className}>
54+
<div className="mt-4">
55+
<Text className=" text-white text-2xl tracking-wide" fontWeight="400">
56+
{renderWords()}
57+
</Text>
58+
</div>
59+
</div>
60+
);
61+
};
62+
63+
export default TextGenerateEffect;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as TextGenerateEffect } from './GenerateText';

src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ export * from './SpotlightCard';
1212
export * from './Timeline';
1313
export * from './3dPin';
1414
export * from './TypeWriterText';
15+
export * from './GenerateText';
1516
export * from './ShinyText';
1617
export * from './WavyBackground';

src/screens/mainFlow/contents/AboutMe.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { Box, Heading, HStack, Text, VStack } from '@chakra-ui/react';
1+
import { Heading, HStack, VStack } from '@chakra-ui/react';
22
import { useCursor } from '@components';
33
import { useIsIntersecting } from '@hooks';
44
import { useEffect, useRef } from 'react';
55
import { useTranslation } from 'react-i18next';
6+
import { TextGenerateEffect } from '@components';
67

78
const AboutMe = () => {
89
const { t } = useTranslation();
@@ -17,13 +18,18 @@ const AboutMe = () => {
1718
}, [isIntersecting, setCursorType]);
1819

1920
return (
20-
<VStack ref={containerRef} minH={'100vh'} id="about" paddingTop={24}>
21-
<Box rowGap={10}>
22-
<Heading textAlign={'start'}>{t('about.title')}</Heading>
23-
<HStack>
24-
<Text>{t('about.aboutMe')}</Text>
25-
</HStack>
26-
</Box>
21+
<VStack
22+
ref={containerRef}
23+
minH={'100vh'}
24+
id="about"
25+
width={'99vw'}
26+
paddingX={32}
27+
paddingY={24}
28+
>
29+
<Heading width={'100%'} textAlign={'start'}>
30+
{t('about.title')}
31+
</Heading>
32+
<TextGenerateEffect words={t('about.aboutMe')} />
2733
</VStack>
2834
);
2935
};

src/screens/mainFlow/contents/Contact.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import { Box, Heading, HStack, Text, VStack } from '@chakra-ui/react';
1+
import { Box, Heading, HStack } from '@chakra-ui/react';
22
import { useTranslation } from 'react-i18next';
33

44
const Contact = () => {
55
const { t } = useTranslation();
66
return (
7-
<VStack minH={'100vh'} id="contact" paddingTop={24}>
8-
<Box rowGap={10} width={'full'}>
9-
<Heading textAlign={'start'}>{t('contact.title')}</Heading>
10-
<HStack></HStack>
11-
</Box>
12-
</VStack>
7+
<Box minH={'100vh'} id="contact" paddingTop={24} rowGap={10}>
8+
<Heading textAlign={'start'}>{t('contact.title')}</Heading>
9+
<HStack></HStack>
10+
</Box>
1311
);
1412
};
1513

src/screens/mainFlow/contents/Work.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ const Work = () => {
77
<Box
88
zIndex={100}
99
height={'100vh'}
10-
width={'100vw'}
10+
width={'99vw'}
1111
id="work"
12-
position={'sticky'}
13-
top={'15vh'}
1412
paddingX={32}
15-
paddingY={{ base: 16, md: 24 }}
13+
paddingY={24}
1614
>
1715
<Heading>{t('work.title')}</Heading>
1816
</Box>

0 commit comments

Comments
 (0)