-
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.
FEAT: Work experience section, disbale movements based on user prefer…
…ence (#6) * chore: added scroll snap on home page * chore: added error page and updated copy on not-found page * chore: use constants for internal links instead of hard coded values * chore: added fade in effect for hero section * replace blog with about * fix: back to home link in not found page * chore: improve fade in effect and bounce effect * chore: disable animation if prefers-reduced-motion is set to reduce * chore: added experice cards and replaced inter with rethink-sans * chore: updated layout of work section, improved animation on work section * chore: updated package version to 0.1.3 * chore: removed blog link from sitemap --------- Co-authored-by: ArjunGTX <[email protected]>
- Loading branch information
1 parent
ab86378
commit bdfe528
Showing
24 changed files
with
658 additions
and
238 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,96 @@ | ||
"use client"; | ||
|
||
import { Experience } from "@/utils/experiences"; | ||
import Image from "next/image"; | ||
import React from "react"; | ||
import { motion } from "framer-motion"; | ||
import { ExperienceDescription } from "./ExperienceDescription"; | ||
import { CustomLink } from "@/components/CustomLink"; | ||
|
||
type Props = { | ||
experience: Experience; | ||
}; | ||
|
||
const container = { | ||
hidden: { opacity: 0, y: 100 }, | ||
show: { | ||
opacity: 1, | ||
y: 0, | ||
transition: { | ||
staggerChildren: 0.1, | ||
}, | ||
}, | ||
}; | ||
|
||
const item = { | ||
hidden: { opacity: 0, y: 100 }, | ||
show: { opacity: 1, y: 0 }, | ||
}; | ||
|
||
export const ExperienceCard: React.FC<Props> = ({ experience }) => { | ||
return ( | ||
<div className="w-full grid grid-cols-1 gap-6 md:gap-20 min-h-[66vh]"> | ||
<motion.div | ||
variants={container} | ||
viewport={{ once: true }} | ||
initial="hidden" | ||
whileInView="show" | ||
className="flex flex-col justify-start items-start" | ||
> | ||
<motion.h3 | ||
viewport={{ once: true }} | ||
variants={item} | ||
className="text-xl lg:text-2xl xl:text-3xl mb-1 uppercase" | ||
> | ||
{experience.title} | ||
</motion.h3> | ||
<motion.p | ||
variants={item} | ||
viewport={{ once: true }} | ||
className="flex text-xs lg:text-base text-secondary justify-start items-center" | ||
> | ||
<CustomLink | ||
href={experience.companyLink} | ||
target="_blank" | ||
className="text-xs lg:text-base text-secondary hover:text-primary hover:underline" | ||
> | ||
{experience.company} | ||
</CustomLink> | ||
• {experience.date} | ||
</motion.p> | ||
<CustomLink | ||
href={experience.imageLink} | ||
target="_blank" | ||
className="w-full md:w-3/4 xl:w-[80%]" | ||
> | ||
<motion.div | ||
variants={item} | ||
viewport={{ once: true }} | ||
className="relative overflow-hidden rounded-lg aspect-[2.2/1] w-full my-2" | ||
> | ||
<Image | ||
className="object-cover" | ||
alt={experience.imageAlt} | ||
src={experience.image} | ||
fill | ||
/> | ||
</motion.div> | ||
</CustomLink> | ||
<motion.p | ||
variants={item} | ||
viewport={{ once: true }} | ||
className="text-xs md:text-sm lg:text-lg text-secondary font-medium mt-1" | ||
> | ||
{experience.subheading} | ||
</motion.p> | ||
<ul className="w-full flex flex-col p-0 gap-2 mt-2"> | ||
{experience.descriptions.map((description, index) => ( | ||
<li className="flex" key={index}> | ||
<ExperienceDescription description={description} index={index} /> | ||
</li> | ||
))} | ||
</ul> | ||
</motion.div> | ||
</div> | ||
); | ||
}; |
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,58 @@ | ||
"use client"; | ||
|
||
import { | ||
animate, | ||
useInView, | ||
useMotionValue, | ||
useTransform, | ||
} from "framer-motion"; | ||
import React, { useEffect, useRef } from "react"; | ||
import { motion } from "framer-motion"; | ||
|
||
type Props = { | ||
description: string; | ||
index: number; | ||
}; | ||
|
||
export const ExperienceDescription: React.FC<Props> = ({ | ||
description, | ||
index, | ||
}) => { | ||
const descriptionRef = useRef<HTMLParagraphElement>(null); | ||
|
||
const duration = 4; | ||
const delay = 0.75 + duration * index; | ||
|
||
const count = useMotionValue(0); | ||
const rounded = useTransform(count, (latest) => Math.round(latest)); | ||
const displayText = useTransform(rounded, (latest) => | ||
description.slice(0, latest), | ||
); | ||
|
||
const isInView = useInView(descriptionRef); | ||
|
||
useEffect(() => { | ||
const controls = animate(count, description.length, { | ||
type: "tween", | ||
duration, | ||
ease: "linear", | ||
autoplay: false, | ||
delay, | ||
}); | ||
if (isInView) { | ||
controls.play(); | ||
} else { | ||
controls.stop(); | ||
} | ||
return controls.stop; | ||
}, [description.length, isInView, count, delay, duration]); | ||
|
||
return ( | ||
<motion.p | ||
ref={descriptionRef} | ||
className="text-tertiary text-xs md:text-sm lg:text-base xl:text-lg leading-normal" | ||
> | ||
{displayText} | ||
</motion.p> | ||
); | ||
}; |
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
Oops, something went wrong.