11"use client" ;
22
3- import { useEffect , useState , useRef , useContext } from "react" ;
3+ import { useEffect , useState , useRef } from "react" ;
44import Link from "next/link" ;
55import { LazyMotion , domAnimation , useInView } from "framer-motion" ;
66import { WelcomeAnimation } from "./IntroAnimation" ;
77import { useScrollTo } from "hooks" ;
8- import { LayoutContext } from "context/layout" ;
98import { useMediaQuery } from "utils" ;
109
1110export function WelcomeSection ( ) {
1211 const ref = useRef ( null ) ;
13- const { introRef, setIntroHeight } = useContext ( LayoutContext ) ;
12+ const introRef = useRef ( null ) ;
1413 const isInView = useInView ( ref , { once : true } ) ;
1514 const { scrollToEl } = useScrollTo ( ) ;
1615 const isTabletUp = useMediaQuery ( "min-width: 768px" ) ;
@@ -37,100 +36,94 @@ export function WelcomeSection() {
3736 return ( ) => clearInterval ( interval ) ;
3837 } , [ count ] ) ;
3938
40- useEffect ( ( ) => {
41- setIntroHeight ( introRef . current ?. offsetHeight ) ;
42- } , [ introRef , setIntroHeight ] ) ;
43-
4439 return (
4540 < LazyMotion features = { domAnimation } >
46- < section
47- id = "intro"
48- className = "section grid grid-cols-1 md:grid-cols-[1fr_0.5fr] lg:grid-cols-[1fr_0.7fr] gap-4 items-center"
49- ref = { introRef }
50- >
51- < div className = "py-5 md:py-10" >
52- < h1
53- tabIndex = "0"
54- ref = { ref }
55- className = "text-3xl md:text-5xl xl:text-6xl font-bold"
56- style = { {
57- transform : isInView ? "none" : "translateX(-200px)" ,
58- opacity : isInView ? 1 : 0 ,
59- transition : "all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s"
60- } }
61- >
62- < p >
63- Hi, I'm < mark > Vasile</ mark > a < mark > passionate</ mark > software developer.
64- </ p >
65- </ h1 >
66-
67- < div className = "mt-3 relative flex flex-col overflow-hidden" >
68- < p
41+ < section id = "intro" className = "section" ref = { introRef } >
42+ < div className = "grid grid-cols-1 md:grid-cols-[1fr_0.5fr] lg:grid-cols-[1fr_0.7fr] gap-4 items-center" >
43+ < div className = "py-5 md:py-10" >
44+ < h1
45+ tabIndex = "0"
6946 ref = { ref }
70- className = "text-2xl transform-none opacity-100 "
47+ className = "text-3xl md:text-5xl xl:text-6xl font-bold "
7148 style = { {
7249 transform : isInView ? "none" : "translateX(-200px)" ,
7350 opacity : isInView ? 1 : 0 ,
7451 transition : "all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s"
7552 } }
7653 >
77- I
78- < span
79- className = "absolute flex flex-col transition-all duration-500 ease-in-expo"
54+ < p >
55+ Hi, I'm < mark > Vasile</ mark > a < mark > passionate</ mark > software developer.
56+ </ p >
57+ </ h1 >
58+
59+ < div className = "mt-3 relative flex flex-col overflow-hidden" >
60+ < p
61+ ref = { ref }
62+ className = "text-2xl transform-none opacity-100"
8063 style = { {
81- top : count === 0 ? "0" : count === 1 ? "-100%" : count === 2 ? "-200%" : "0" ,
82- left : "13px"
64+ transform : isInView ? "none" : "translateX(-200px)" ,
65+ opacity : isInView ? 1 : 0 ,
66+ transition : "all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s"
8367 } }
8468 >
85- { text . map ( ( element ) => (
86- < TextElement key = { element } element = { element } />
87- ) ) }
88- </ span >
89- </ p >
90- </ div >
69+ I
70+ < span
71+ className = "absolute flex flex-col transition-all duration-500 ease-in-expo"
72+ style = { {
73+ top : count === 0 ? "0" : count === 1 ? "-100%" : count === 2 ? "-200%" : "0" ,
74+ left : "13px"
75+ } }
76+ >
77+ { text . map ( ( element ) => (
78+ < TextElement key = { element } element = { element } />
79+ ) ) }
80+ </ span >
81+ </ p >
82+ </ div >
9183
92- < p
93- tabIndex = "0"
94- ref = { ref }
95- className = "mt-3 mb-10 text-gray-500 text-xl"
96- style = { {
97- transform : isInView ? "none" : "translateX(-200px)" ,
98- opacity : isInView ? 1 : 0 ,
99- transition : "all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s"
100- } }
101- >
102- Stick around to see some of my work.
103- </ p >
104- < div
105- ref = { ref }
106- style = { {
107- transform : isInView ? "none" : "translateY(50px)" ,
108- opacity : isInView ? 1 : 0 ,
109- transition : "all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s"
110- } }
111- >
112- < Link
113- href = "#projects"
114- onClick = { onClick }
84+ < p
11585 tabIndex = "0"
116- className = "btn"
117- aria-label = "Latest projects"
86+ ref = { ref }
87+ className = "mt-3 mb-10 text-gray-500 text-xl"
88+ style = { {
89+ transform : isInView ? "none" : "translateX(-200px)" ,
90+ opacity : isInView ? 1 : 0 ,
91+ transition : "all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s"
92+ } }
93+ >
94+ Stick around to see some of my work.
95+ </ p >
96+ < div
97+ ref = { ref }
98+ style = { {
99+ transform : isInView ? "none" : "translateY(50px)" ,
100+ opacity : isInView ? 1 : 0 ,
101+ transition : "all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s"
102+ } }
118103 >
119- See my latest projects
120- </ Link >
104+ < Link
105+ href = "#projects"
106+ onClick = { onClick }
107+ tabIndex = "0"
108+ className = "btn"
109+ aria-label = "Latest projects"
110+ >
111+ See my latest projects
112+ </ Link >
113+ </ div >
121114 </ div >
122- </ div >
123115
124- { isTabletUp && (
125- < div
126- style = { {
127- backgroundColor : "#FFFFFF" ,
128- mixBlendMode : "color-burn"
129- } }
130- >
131- < WelcomeAnimation />
132- </ div >
133- ) }
116+ { isTabletUp && (
117+ < div
118+ style = { {
119+ backgroundColor : "#FFFFFF" ,
120+ mixBlendMode : "color-burn"
121+ } }
122+ >
123+ < WelcomeAnimation />
124+ </ div >
125+ ) }
126+ </ div >
134127 </ section >
135128 </ LazyMotion >
136129 ) ;
0 commit comments