Skip to content

Commit 89242e0

Browse files
committed
Added bouncing arrow in hero section
1 parent 77d6cd8 commit 89242e0

9 files changed

+180
-62
lines changed

Diff for: components/AboutSection.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react"
2+
import Image from "next/image"
23

34
const skills = [
45
{ skill: "HTML" },
@@ -16,9 +17,8 @@ const skills = [
1617

1718
const AboutSection = () => {
1819
return (
19-
2020
<section id="about">
21-
<div className="my-28">
21+
<div className="my-12 pt-12 md:pt-16 md:pb-48">
2222
<h1 className="text-center font-bold text-4xl">
2323
About Me
2424
<hr className="w-6 h-1 mx-auto my-4 bg-teal-500 border-0 rounded"></hr>
@@ -63,7 +63,7 @@ const AboutSection = () => {
6363
</div>
6464
<div className="text-center md:w-1/2 md:text-left">
6565
<h1 className="text-2xl font-bold mb-6">My Skills</h1>
66-
<div className="flex flex-wrap flex-row justify-center md:justify-start">
66+
<div className="flex flex-wrap flex-row justify-center z-10 md:justify-start">
6767
{skills.map((item, idx) => {
6868
return (
6969
<p
@@ -75,6 +75,13 @@ const AboutSection = () => {
7575
)
7676
})}
7777
</div>
78+
<Image
79+
src="/hero-image.png"
80+
alt=""
81+
width={325}
82+
height={325}
83+
className="hidden md:block md:relative md:bottom-4 md:left-32 md:z-0"
84+
/>
7885
</div>
7986
</div>
8087
</div>

Diff for: components/HeroSection.tsx

+32-16
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,57 @@
1+
"use client" // this is a client component
12
import React from "react"
23
import Image from "next/image"
3-
4-
4+
import { Link } from "react-scroll/modules"
5+
import { HiArrowDown } from "react-icons/hi"
56

67
const HeroSection = () => {
78
return (
8-
<section id="home" className="-top-12">
9-
<div className="flex flex-col text-center items-center justify-center my-24 md:flex-row md:text-left">
10-
<div className="md:w-1/2">
9+
<section id="home">
10+
<div className="flex flex-col text-center items-center justify-center animate-fadeIn animation-delay-2 my-10 py-16 sm:py-32 md:py-52 md:flex-row md:space-x-4 md:text-left">
11+
<div className="md:mt-2 md:w-1/2">
1112
<Image
1213
src="/headshot.png"
1314
alt=""
14-
width={300}
15-
height={300}
16-
className="rounded-full shadow-2xl mt-8"
15+
width={325}
16+
height={325}
17+
className="rounded-full shadow-2xl"
1718
/>
1819
</div>
19-
<div className="mt-4 md:w-3/5">
20-
<h1 className="text-4xl font-bold md:text-6xl">
21-
Hi, I&#39;m Hosna!
22-
</h1>
23-
<p className="text-lg mt-4 mb-6 md:pr-28 md:text-xl">
20+
<div className="md:mt-2 md:w-3/5">
21+
<h1 className="text-4xl font-bold mt-6 md:mt-0 md:text-7xl">Hi, I&#39;m Hosna!</h1>
22+
<p className="text-lg mt-4 mb-6 md:text-2xl">
2423
I&#39;m a{" "}
2524
<span className="font-semibold text-teal-600">
2625
Software Engineer{" "}
2726
</span>
2827
based in Los Angeles, CA. Working towards creating software that
2928
makes life easier and more meaningful.
3029
</p>
31-
<a
30+
<Link
31+
to="projects"
3232
className="text-neutral-100 font-semibold px-6 py-3 bg-teal-600 rounded shadow hover:bg-teal-700"
33-
href="#projects"
33+
activeClass="active"
34+
spy={true}
35+
smooth={true}
36+
offset={-100}
37+
duration={500}
3438
>
3539
Projects
36-
</a>
40+
</Link>
3741
</div>
3842
</div>
43+
<div className="flex flex-row items-center text-center justify-center ">
44+
<Link
45+
to="about"
46+
activeClass="active"
47+
spy={true}
48+
smooth={true}
49+
offset={-100}
50+
duration={500}
51+
>
52+
<HiArrowDown size={35} className="animate-bounce" />
53+
</Link>
54+
</div>
3955
</section>
4056
)
4157
}

Diff for: components/Navbar.tsx

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
"use client" // this is a client component
22
import React from "react"
33
import { useState } from "react"
4-
5-
import Link from "next/link"
4+
import { Link } from "react-scroll/modules"
65
import { usePathname } from "next/navigation"
76
import { useTheme } from "next-themes"
87
import { RiMoonFill, RiSunLine } from "react-icons/ri"
98
import { IoMdMenu, IoMdClose } from "react-icons/io"
109

1110
interface NavItem {
1211
label: string
13-
id?: string
12+
page: string
1413
}
1514

1615
const NAV_ITEMS: Array<NavItem> = [
1716
{
1817
label: "Home",
19-
id: "#home",
18+
page: "home",
2019
},
2120
{
2221
label: "About",
23-
id: "#about",
22+
page: "about",
2423
},
2524
{
2625
label: "Projects",
27-
id: "#projects",
26+
page: "projects",
2827
},
2928
]
3029

@@ -38,7 +37,7 @@ export default function Navbar() {
3837
<div className="justify-between md:items-center md:flex">
3938
<div>
4039
<div className="flex items-center justify-between py-3 md:py-5 md:block">
41-
<Link href="#home">
40+
<Link to="home">
4241
<div className="container flex items-center space-x-2">
4342
<h2 className="text-2xl font-bold">Hosna Qasmei</h2>
4443
</div>
@@ -60,21 +59,24 @@ export default function Navbar() {
6059
navbar ? "block" : "hidden"
6160
}`}
6261
>
63-
<div className=" items-center justify-center space-y-8 md:flex md:space-x-6 md:space-y-0">
62+
<div className="items-center justify-center space-y-8 md:flex md:space-x-6 md:space-y-0">
6463
{NAV_ITEMS.map((item, idx) => {
6564
return (
66-
<a
65+
<Link
6766
key={idx}
67+
to={item.page}
6868
className={
69-
pathname == `${item.id}`
70-
? "font-bold"
71-
: "block lg:inline-block text-neutral-900 hover:text-neutral-500 dark:text-neutral-100"
69+
"block lg:inline-block text-neutral-900 hover:text-neutral-500 dark:text-neutral-100"
7270
}
73-
href={item.id}
71+
activeClass="active"
72+
spy={true}
73+
smooth={true}
74+
offset={-100}
75+
duration={500}
7476
onClick={() => setNavbar(!navbar)}
7577
>
7678
{item.label}
77-
</a>
79+
</Link>
7880
)
7981
})}
8082
{currentTheme === "dark" ? (

Diff for: components/ProjectsSection.tsx

+33-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react"
22
import Image from "next/image"
33
import Link from "next/link"
4+
import SlideUp from "./SlideUp"
45
import { BsGithub, BsArrowUpRightSquare } from "react-icons/bs"
56

67
const projects = [
@@ -41,42 +42,45 @@ const ProjectsSection = () => {
4142
{projects.map((project, idx) => {
4243
return (
4344
<div key={idx}>
44-
<div className="flex flex-col md:flex-row md:space-x-12">
45-
<div className="md:w-1/2">
46-
<Link href={project.link}>
47-
<Image
48-
src={project.image}
49-
alt=""
50-
width={1000}
51-
height={1000}
52-
className="rounded-xl shadow-xl hover:opacity-90"
53-
/>
54-
</Link>
55-
</div>
56-
<div className="mt-8 md:w-1/2">
57-
<h1 className="text-4xl font-bold mb-6">{project.name}</h1>
58-
<p className="text-xl leading-7 mb-4 text-neutral-600 dark:text-neutral-400">
59-
{project.description}
60-
</p>
61-
<div className="flex flex-row align-bottom space-x-4">
62-
<Link href={project.github} target="_blank">
63-
<BsGithub
64-
size={30}
65-
className="hover:-translate-y-1 transition-transform cursor-pointer"
66-
/>
67-
</Link>
68-
<Link href={project.link} target="_blank">
69-
<BsArrowUpRightSquare
70-
size={30}
71-
className="hover:-translate-y-1 transition-transform cursor-pointer"
45+
<SlideUp offset="-300px 0px -300px 0px">
46+
<div className="flex flex-col animate-slideUpCubiBezier animation-delay-2 md:flex-row md:space-x-12">
47+
<div className=" md:w-1/2">
48+
<Link href={project.link}>
49+
<Image
50+
src={project.image}
51+
alt=""
52+
width={1000}
53+
height={1000}
54+
className="rounded-xl shadow-xl hover:opacity-70"
7255
/>
7356
</Link>
7457
</div>
58+
<div className="mt-8 md:w-1/2">
59+
<h1 className="text-4xl font-bold mb-6">{project.name}</h1>
60+
<p className="text-xl leading-7 mb-4 text-neutral-600 dark:text-neutral-400">
61+
{project.description}
62+
</p>
63+
<div className="flex flex-row align-bottom space-x-4">
64+
<Link href={project.github} target="_blank">
65+
<BsGithub
66+
size={30}
67+
className="hover:-translate-y-1 transition-transform cursor-pointer"
68+
/>
69+
</Link>
70+
<Link href={project.link} target="_blank">
71+
<BsArrowUpRightSquare
72+
size={30}
73+
className="hover:-translate-y-1 transition-transform cursor-pointer"
74+
/>
75+
</Link>
76+
</div>
77+
</div>
7578
</div>
76-
</div>
79+
</SlideUp>
7780
</div>
7881
)
7982
})}
83+
8084
</div>
8185
</section>
8286
)

Diff for: components/SlideUp.tsx

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"use client" // this is a client component
2+
3+
import React, { useEffect, useRef, ReactNode } from "react"
4+
interface Props {
5+
offset?: string
6+
children?: ReactNode
7+
// any props that come into the component
8+
}
9+
10+
export default function SlideUp({ children, offset = "0px" }: Props) {
11+
const ref = useRef(null)
12+
13+
useEffect(() => {
14+
const observer = new IntersectionObserver(
15+
(entries) => {
16+
entries.forEach((entry) => {
17+
if (entry.isIntersecting) {
18+
entry.target.classList.remove("opacity-0")
19+
entry.target.classList.add("animate-slideUpCubiBezier")
20+
}
21+
})
22+
},
23+
{ rootMargin: offset }
24+
)
25+
26+
if (ref.current) {
27+
observer.observe(ref.current)
28+
}
29+
}, [ref])
30+
31+
return (
32+
<div ref={ref} className="relative opacity-0">
33+
{children}
34+
</div>
35+
)
36+
}

Diff for: package-lock.json

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
"react": "18.2.0",
2121
"react-dom": "18.2.0",
2222
"react-icons": "^4.7.1",
23+
"react-scroll": "^1.8.9",
2324
"typescript": "4.9.4"
2425
},
2526
"devDependencies": {
27+
"@types/react-scroll": "^1.8.6",
2628
"autoprefixer": "^10.4.13",
2729
"postcss": "^8.4.21",
2830
"tailwindcss": "^3.2.4"

Diff for: public/hero-image.png

171 KB
Loading

0 commit comments

Comments
 (0)