diff --git a/shared/ui/src/lib/Footer.tsx b/shared/ui/src/lib/Footer.tsx index 242a22a0..0cc08dc4 100644 --- a/shared/ui/src/lib/Footer.tsx +++ b/shared/ui/src/lib/Footer.tsx @@ -1,7 +1,11 @@ import { LogoImageNeutral } from './LogoImageNeutral'; -export const Footer = () => ( -
+export interface FooterProps { + className?: string; +} + +export const Footer = ({ className }: FooterProps) => ( +
); diff --git a/shared/ui/src/lib/NavLink.tsx b/shared/ui/src/lib/NavLink.tsx index 3878bf2b..ca3863a8 100644 --- a/shared/ui/src/lib/NavLink.tsx +++ b/shared/ui/src/lib/NavLink.tsx @@ -1,11 +1,14 @@ -import { forwardRef, Ref } from 'react'; -import { NavLink as RouterNavLink, NavLinkProps, To } from 'react-router-dom'; import { eventBus } from '@jasonruesch/shared/utils'; +import { forwardRef, Ref } from 'react'; +import { NavLinkProps, NavLink as RouterNavLink, To } from 'react-router-dom'; export const NavLink = forwardRef( ({ to, ...props }: NavLinkProps, ref: Ref) => { const intendToNavigate = (to: To) => { - eventBus.dispatch('intendToNavigate', { to: to as string }); + eventBus.dispatch('intendToNavigate', { + to: to as string, + y: window.scrollY, + }); }; return ( diff --git a/shared/ui/src/lib/PageTransitions.tsx b/shared/ui/src/lib/PageTransitions.tsx index 62a4d478..c2104307 100644 --- a/shared/ui/src/lib/PageTransitions.tsx +++ b/shared/ui/src/lib/PageTransitions.tsx @@ -28,6 +28,7 @@ export const PageTransitions = ({ const [isNavigating, setIsNavigating] = useState(false); const [slideRight, setSlideRight] = useState(false); const { resolvedTheme } = useTheme(); + const [routingPageOffset, setRoutingPageOffset] = useState(0); useEffect(() => { if (previousPathname !== pathname) { @@ -50,9 +51,10 @@ export const PageTransitions = ({ pageMap.get(next)! < pageMap.get(current)!; // eslint-disable-next-line @typescript-eslint/no-explicit-any - const handleIntendToNavigate = ({ to }: any) => { + const handleIntendToNavigate = ({ to, y }: any) => { const slideRight = shouldSlideRight(pathname, to); setSlideRight(slideRight); + setRoutingPageOffset(y); }; eventBus.on('intendToNavigate', handleIntendToNavigate); @@ -74,7 +76,7 @@ export const PageTransitions = ({ window.scrollTo(0, 0)} + // onExitComplete={() => window.scrollTo(0, 0)} > - {children} + + {children} +
diff --git a/shared/ui/src/lib/PageTransitionsVariants.ts b/shared/ui/src/lib/PageTransitionsVariants.ts index ff74c013..5b2ffb6c 100644 --- a/shared/ui/src/lib/PageTransitionsVariants.ts +++ b/shared/ui/src/lib/PageTransitionsVariants.ts @@ -1,7 +1,7 @@ import { Variants } from 'framer-motion'; const SCALE = 0.6; -const DURATION = 2; // seconds +const DURATION = 1.5; // seconds export interface VariantProps { windowSize: { width: number; height: number }; diff --git a/shared/ui/src/lib/ThemeSelector.tsx b/shared/ui/src/lib/ThemeSelector.tsx index d7e4b14c..c333df8b 100644 --- a/shared/ui/src/lib/ThemeSelector.tsx +++ b/shared/ui/src/lib/ThemeSelector.tsx @@ -1,16 +1,34 @@ -import { Fragment, useEffect } from 'react'; import { Menu, Transition } from '@headlessui/react'; import { - SunIcon, - MoonIcon, - ComputerDesktopIcon, -} from '@heroicons/react/24/solid'; -import { - SunIcon as SunIconOutline, MoonIcon as MoonIconOutline, + SunIcon as SunIconOutline, } from '@heroicons/react/24/outline'; +import { + ComputerDesktopIcon, + MoonIcon, + SunIcon, +} from '@heroicons/react/24/solid'; import clsx from 'clsx'; import { useTheme } from 'next-themes'; +import { Fragment, useEffect } from 'react'; + +const menuItems = [ + { + name: 'Light', + theme: 'light', + icon: