fix: resize feed column width

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-07-26 12:56:58 +08:00
parent 26e4f3d474
commit 5701124306
@@ -97,7 +97,14 @@ export function FeedColumn({ children }: PropsWithChildren) {
}, [setActive_])
useLayoutEffect(() => {
const handler = () => {
spring.jump(-active * jotaiStore.get(carouselWidthAtom))
}
const dispose = jotaiStore.sub(carouselWidthAtom, handler)
spring.set(-active * jotaiStore.get(carouselWidthAtom))
return () => {
dispose()
}
}, [active, spring])
useHotkeys(