-
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.
[LastVideo] animation: introduce animation to content section
- Loading branch information
Showing
6 changed files
with
103 additions
and
14 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
Components/LatestVideo/Content-Wrapper/Content-Wrapper.component.module.scss
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,11 @@ | ||
@import "@/sass/settings.scss"; | ||
|
||
.content { | ||
@include d-flex-column; | ||
height: 50%; | ||
gap: 2rem; | ||
padding: $standard-padding; | ||
@media screen and (min-width: $mobile) { | ||
padding-left: 3rem; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Components/LatestVideo/Content-Wrapper/Content-Wrapper.component.tsx
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,41 @@ | ||
"use client"; | ||
|
||
import { motion } from "framer-motion"; | ||
import { useInView } from "react-intersection-observer"; | ||
|
||
import s from './Content-Wrapper.component.module.scss'; | ||
import { type ReactNode } from "react"; | ||
|
||
type ContentWrapperProps = { | ||
children: ReactNode; | ||
} | ||
|
||
function ContentWrapper({ children }: ContentWrapperProps) { | ||
const { ref, inView } = useInView({ | ||
triggerOnce: true, | ||
threshold: 0.5, | ||
}); | ||
|
||
const animationVariants = { | ||
hidden: { opacity: 0, y: 50 }, | ||
visible: { | ||
opacity: 1, | ||
y: 0, | ||
transition: { duration: 0.5, ease: "easeOut" }, | ||
}, | ||
}; | ||
|
||
return ( | ||
<motion.section | ||
className={s.content} | ||
ref={ref} | ||
initial="hidden" | ||
animate={inView ? "visible" : "hidden"} | ||
variants={animationVariants} | ||
> | ||
{children} | ||
</motion.section> | ||
); | ||
} | ||
|
||
export default ContentWrapper; |
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
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