Skip to content

Commit

Permalink
update lenis
Browse files Browse the repository at this point in the history
  • Loading branch information
clementroche committed Nov 14, 2024
1 parent 4d05f1a commit 69fc56e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 29 deletions.
19 changes: 11 additions & 8 deletions .husky/_/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,25 @@ call_lefthook()
if test -n "$LEFTHOOK_BIN"
then
"$LEFTHOOK_BIN" "$@"
elif lefthook -h >/dev/null 2>&1
elif lefthook.exe -h >/dev/null 2>&1
then
lefthook "$@"
lefthook.exe "$@"
elif lefthook.bat -h >/dev/null 2>&1
then
lefthook.bat "$@"
else
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe"
then
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"
Expand Down
19 changes: 11 additions & 8 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,25 @@ call_lefthook()
if test -n "$LEFTHOOK_BIN"
then
"$LEFTHOOK_BIN" "$@"
elif lefthook -h >/dev/null 2>&1
elif lefthook.exe -h >/dev/null 2>&1
then
lefthook "$@"
lefthook.exe "$@"
elif lefthook.bat -h >/dev/null 2>&1
then
lefthook.bat "$@"
else
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe"
then
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"
Expand Down
19 changes: 11 additions & 8 deletions .husky/_/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,25 @@ call_lefthook()
if test -n "$LEFTHOOK_BIN"
then
"$LEFTHOOK_BIN" "$@"
elif lefthook -h >/dev/null 2>&1
elif lefthook.exe -h >/dev/null 2>&1
then
lefthook "$@"
lefthook.exe "$@"
elif lefthook.bat -h >/dev/null 2>&1
then
lefthook.bat "$@"
else
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe"
then
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook.exe" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook.exe" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook.exe" "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"
Expand Down
20 changes: 15 additions & 5 deletions app/(pages)/(components)/lenis/index.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
'use client'
"use client"

import 'lenis/dist/lenis.css'
import { ReactLenis } from 'lenis/react'
import { useFrame } from "@darkroom.engineering/hamo"
import "lenis/dist/lenis.css"
import { ReactLenis } from "lenis/react"
import { useRef } from "react"

export function Lenis({ root, options }) {
const lenisRef = useRef()

useFrame((time) => {
lenisRef.current.lenis.raf(time)
}, 0)

return (
<ReactLenis
ref={lenisRef}
root={root}
options={{
...options,
autoRaf: false,
prevent: (node) => {
return (
node.nodeName === 'VERCEL-LIVE-FEEDBACK' ||
node.id === 'theatrejs-studio-root'
node.nodeName === "VERCEL-LIVE-FEEDBACK" ||
node.id === "theatrejs-studio-root"
)
},
}}
Expand Down

0 comments on commit 69fc56e

Please sign in to comment.