Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
⚡️ Reduce state updates
Luke Vellaa38c1d85878c
diff --git a/apps/landing/src/app/[locale]/(main)/open-source-banner.tsx b/apps/landing/src/app/[locale]/(main)/open-source-banner.tsxindex 05485ded5..95ebb41b4 100644--- a/apps/landing/src/app/[locale]/(main)/open-source-banner.tsx+++ b/apps/landing/src/app/[locale]/(main)/open-source-banner.tsx@@ -5,18 +5,28 @@ import { ArrowUpRightIcon } from "lucide-react";import GithubIcon from "@/assets/github.svg";import { Trans } from "@/i18n/client/trans";import { cn } from "@rallly/ui";-import { useWindowScroll } from "react-use";+import React from "react";export function OpenSourceBanner() {- const { y } = useWindowScroll();+ const [visible, setVisible] = React.useState(true);++ React.useEffect(() => {+ function setVisibility() {+ setVisible(window.scrollY < 20);+ }+ window.addEventListener("scroll", setVisibility);+ return () => {+ window.removeEventListener("scroll", setVisibility);+ };+ }, []);return (<divclassName={cn("bg-gray-800 z-50 transition-transform h-11 overflow-hidden hover:underline fixed top-0 w-full flex items-center text-sm rounded-none text-gray-100 justify-center gap-4",{- "translate-y-0": y <= 0,- "-translate-y-full": y > 20,+ "translate-y-0": visible,+ "-translate-y-full": !visible,},)}>