Two way scroll binding
This commit is contained in:
@@ -2,10 +2,11 @@ import { createViewportObserver } from '@solid-primitives/intersection-observer'
|
||||
|
||||
import { useStore } from '../../store/index';
|
||||
import type { Store } from '../../store/index';
|
||||
import { scrollHereWhenSelected } from "../../utlis/scroll";
|
||||
import styles from './Projects.module.css';
|
||||
|
||||
export default () => {
|
||||
const [, { setVisibleChapter }] = useStore() as Store;
|
||||
const [store, { setVisibleChapter }] = useStore() as Store;
|
||||
const [observer] = createViewportObserver({threshold: 0.9});
|
||||
|
||||
return (
|
||||
@@ -15,6 +16,7 @@ export default () => {
|
||||
setVisibleChapter('projects');
|
||||
}}
|
||||
}
|
||||
ref={(element) => scrollHereWhenSelected(element, store, 'projects')}
|
||||
class={styles.Projects}
|
||||
>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user