Suppress search animation on nav change
This commit is contained in:
parent
37603612a7
commit
05b8a9c9f0
@ -33,9 +33,11 @@ const GAP_CLASS = 'mr-1.5 sm:mr-2';
|
||||
export default function AppViewSwitcher({
|
||||
currentSelection,
|
||||
className,
|
||||
animateSearch = true,
|
||||
}: {
|
||||
currentSelection?: SwitcherSelection
|
||||
className?: string
|
||||
animateSearch?: boolean
|
||||
}) {
|
||||
const pathname = usePathname();
|
||||
|
||||
@ -170,7 +172,7 @@ export default function AppViewSwitcher({
|
||||
/>
|
||||
</Switcher>
|
||||
</motion.div>}
|
||||
<motion.div layout>
|
||||
<motion.div layout={animateSearch}>
|
||||
<Switcher type="borderless">
|
||||
<SwitcherItem
|
||||
icon={<IconSearch includeTitle={false} />}
|
||||
|
||||
@ -40,6 +40,7 @@ export default function Nav({
|
||||
const {
|
||||
classNameStickyContainer,
|
||||
classNameStickyNav,
|
||||
isNavVisible,
|
||||
} = useStickyNav(ref);
|
||||
|
||||
const renderLink = (
|
||||
@ -85,6 +86,7 @@ export default function Nav({
|
||||
<AppViewSwitcher
|
||||
currentSelection={switcherSelectionForPath()}
|
||||
className="translate-x-[-1px]"
|
||||
animateSearch={isNavVisible}
|
||||
/>
|
||||
<div className={clsx(
|
||||
'grow text-right min-w-0',
|
||||
|
||||
@ -37,5 +37,8 @@ export default function useStickyNav(
|
||||
),
|
||||
}), [isNavSticky, shouldAnimateStickyNav, shouldHideStickyNav]);
|
||||
|
||||
return classNames;
|
||||
return {
|
||||
...classNames,
|
||||
isNavVisible: !shouldHideStickyNav,
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user