Update padding in Parallax component for improved layout consistency
Some checks failed
Deploy / deploy (push) Has been cancelled
Some checks failed
Deploy / deploy (push) Has been cancelled
This commit is contained in:
23
src/components/viewport-portal.tsx
Normal file
23
src/components/viewport-portal.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { type ReactNode, useSyncExternalStore } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
const subscribe = () => () => {};
|
||||
const getClientSnapshot = () => true;
|
||||
const getServerSnapshot = () => false;
|
||||
|
||||
/**
|
||||
* Viewport'a sabit kalması gereken öğeleri, transform uygulanan sayfa
|
||||
* katmanının dışına taşır. Böylece üst katmandaki scroll skew animasyonu
|
||||
* `position: fixed` koordinat sistemini değiştirmez.
|
||||
*/
|
||||
export function ViewportPortal({ children }: { children: ReactNode }) {
|
||||
const mounted = useSyncExternalStore(
|
||||
subscribe,
|
||||
getClientSnapshot,
|
||||
getServerSnapshot,
|
||||
);
|
||||
|
||||
return mounted ? createPortal(children, document.body) : null;
|
||||
}
|
||||
Reference in New Issue
Block a user