import React from 'react' import { useMousePosition, useOrientation } from '../utils/hooks' type RenderProps = { x: string, y: string } const Render: React.FC = React.memo(({ children, x, y }) =>
{children}
) const Parallax: React.FC = ({ children }) => { const orientation = useOrientation(true) const mouse = useMousePosition() const convertToDeg = (current: number, factor: number) => `${((.5 - current) * factor).toFixed(2)}deg` const orientationFactor = 3 const x = orientation ? Math.min(orientation.x / orientationFactor, 1) : mouse.relative.x const y = orientation ? Math.min(orientation.y / orientationFactor, 1) : mouse.relative.y return {children} } export default Parallax