Two way scroll binding

This commit is contained in:
2022-05-20 02:19:23 +03:00
parent 158d0efd40
commit 49ae4b0dec
7 changed files with 26 additions and 9 deletions

View File

@@ -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}
>