-
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.
- Loading branch information
1 parent
893cb58
commit 1d4b739
Showing
14 changed files
with
154 additions
and
160 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
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
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,15 @@ | ||
'use client'; | ||
import { motion } from 'motion/react'; | ||
|
||
function WaveIcon() { | ||
return ( | ||
<motion.div | ||
initial={{ opacity: 0, scale: 0 }} | ||
animate={{ opacity: 1, scale: 1 }} | ||
transition={{ type: 'spring', visualDuration: 0.6, bounce: 0.6 }} | ||
> | ||
<div className="origin-bottom-right animate-wiggle text-9xl">👋</div> | ||
</motion.div> | ||
); | ||
} | ||
export default WaveIcon; |
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,30 +1,38 @@ | ||
'use client'; | ||
import useIntersection from '@/hooks/useIntersection'; | ||
import useActiveIndexStore, { | ||
TSectionId, | ||
} from '@/stores/useActiveSectionIdStore'; | ||
import { motion } from 'motion/react'; | ||
import { ComponentProps } from 'react'; | ||
|
||
function SectionWatcher({ | ||
sectionId, | ||
children, | ||
className, | ||
}: { sectionId: TSectionId } & ComponentProps<'section'>) { | ||
const setActiveIndex = useActiveIndexStore((state) => state.setActiveIndex); | ||
const activate = useActiveIndexStore((state) => state.activate); | ||
const deactivate = useActiveIndexStore((state) => state.deactivate); | ||
|
||
const onIntersect = () => { | ||
setActiveIndex(sectionId); | ||
const onViewportEnter = () => { | ||
console.log(sectionId + 'entered'); | ||
activate(sectionId); | ||
}; | ||
|
||
const { setTarget } = useIntersection({ | ||
onIntersect, | ||
options: { rootMargin: '-58% 0px -40%', threshold: 0 }, | ||
}); | ||
const onViewportLeave = () => { | ||
console.log(sectionId + 'leaved'); | ||
deactivate(sectionId); | ||
}; | ||
|
||
return ( | ||
<section id={sectionId} ref={setTarget} className={className}> | ||
<motion.section | ||
id={sectionId} | ||
className={className} | ||
onViewportEnter={onViewportEnter} | ||
onViewportLeave={onViewportLeave} | ||
viewport={{ margin: '0px 0px -10%' }} | ||
> | ||
{children} | ||
</section> | ||
</motion.section> | ||
); | ||
} | ||
export default SectionWatcher; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.