-
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.
SOEOPSFY24-301 | Clean up and remove fade animation for timeline over…
…view and trapezoid
- Loading branch information
1 parent
01922df
commit fb64262
Showing
45 changed files
with
129 additions
and
528 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
export const size = { | ||
small: "w-150 h-150", | ||
medium: "w-200 h-200", | ||
large: "w-300 h-300", | ||
small: "max-w-150 max-h-150", | ||
medium: "max-w-200 max-h-200", | ||
large: "max-w-300 max-h-300", | ||
full: "w-full h-full", | ||
}; | ||
|
||
export const trapezoid = { | ||
1: "trapezoid-1", | ||
2: "trapezoid-2", | ||
3: "trapezoid-3", | ||
4: "trapezoid-4", | ||
left: "rotate-y-[25deg] hocus:rotate-y-[-25deg]", | ||
right: "rotate-y-[-25deg] hocus:rotate-y-[25deg]", | ||
}; |
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 |
---|---|---|
@@ -1,58 +1,66 @@ | ||
import { cnb } from "cnbuilder"; | ||
import * as styles from "./TimelineItem.styles"; | ||
import * as types from "./TimelineItem.types"; | ||
import { XCircleIcon } from "@heroicons/react/24/outline"; | ||
import { Heading, Text } from "../Typography"; | ||
import { AnimatePresence, MotionProps } from "framer-motion"; | ||
|
||
interface TimelineItemProps { | ||
heading: string; | ||
year: string; | ||
image: string; | ||
size?: types.SizeType; | ||
trapezoid?: types.TrapezoidType; | ||
className?: string; | ||
onClick?: () => void; | ||
isSelected?: boolean; | ||
animationProps?: MotionProps; | ||
} | ||
|
||
const TimelineItem = ({ | ||
export const TimelineItem = ({ | ||
heading, | ||
year, | ||
image, | ||
size = "medium", | ||
trapezoid = 1, | ||
isSelected, | ||
trapezoid = "left", | ||
className, | ||
animationProps, | ||
...props | ||
}: TimelineItemProps) => { | ||
const imageSize = styles.size[size]; | ||
const trapezoidType = styles.trapezoid[trapezoid]; | ||
|
||
return ( | ||
<button | ||
<div | ||
{...props} | ||
className={cnb( | ||
"group relative hocus:transform-none", | ||
trapezoidType, | ||
className, | ||
isSelected && "transform-none", | ||
)} | ||
className={cnb("flex flex-col items-center justify-center", className)} | ||
> | ||
<div className={cnb("relative aspect-[1/1]", imageSize)}> | ||
<img | ||
alt="" | ||
src={image} | ||
className="inset-0 w-full h-full object-cover rounded-lg" | ||
/> | ||
</div> | ||
{isSelected && ( | ||
<XCircleIcon | ||
width={50} | ||
className="z-50 absolute flex items-center justify-center text-white group-hocus:text-digital-red" | ||
/> | ||
)} | ||
<p className="z-10 absolute bottom-0 left-0 p-10 rounded bg-black-30"> | ||
{year} | ||
</p> | ||
</button> | ||
<AnimatePresence> | ||
<button className={cnb("group relative", trapezoidType)}> | ||
<div | ||
className={cnb( | ||
"aspect-[1/1] relative perspective-600 group-hocus:scale-105 transform ease-in-out duration-1000", | ||
imageSize, | ||
)} | ||
> | ||
<img | ||
alt="" | ||
src={image} | ||
className="inset-0 w-full h-full object-cover rounded-lg transform ease-in-out duration-1000" | ||
/> | ||
</div> | ||
</button> | ||
<div className="flex flex-col *:font-dm-sans"> | ||
<Heading className="type-0" weight="normal"> | ||
{heading} | ||
</Heading> | ||
<Text | ||
font="serif" | ||
variant="overview" | ||
weight="normal" | ||
className="order-first mt-28" | ||
> | ||
{year} | ||
</Text> | ||
</div> | ||
</AnimatePresence> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TimelineItem; |
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
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.