-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
120 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import type { ReactNode } from 'react'; | ||
import type {ReactNode} from 'react'; | ||
|
||
export const tags = [ | ||
'React', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { createRequestHandler } from "@remix-run/vercel"; | ||
import * as build from "@remix-run/dev/server-build"; | ||
import {createRequestHandler} from '@remix-run/vercel'; | ||
import * as build from '@remix-run/dev/server-build'; | ||
|
||
export default createRequestHandler({ build, mode: process.env.NODE_ENV }); | ||
export default createRequestHandler({build, mode: process.env.NODE_ENV}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {useLocation} from '@remix-run/react'; | ||
import type {FC} from 'react'; | ||
import {useCallback, useEffect, useState} from 'react'; | ||
import {useWindow} from '~/contexts/WindowContext'; | ||
|
||
/** | ||
* | ||
* @returns a custom component to restore scroll position and make it feel like a single page app | ||
*/ | ||
export const ScrollPosition: FC = () => { | ||
const {pathname} = useLocation(); | ||
const windowContext = useWindow(); | ||
const [currentPathname, setCurrentPathname] = useState<string>(pathname); | ||
|
||
const resetScrollPosition = useCallback( | ||
( | ||
_pathname: string, | ||
_currentPathname: string, | ||
_windowContext: ReturnType<typeof useWindow>, | ||
) => { | ||
if (_windowContext && _currentPathname !== _pathname) { | ||
debugger; | ||
window.scroll(0, _windowContext.pageYOffset); | ||
setCurrentPathname(_pathname); | ||
} | ||
}, | ||
[], | ||
); | ||
|
||
useEffect(() => { | ||
resetScrollPosition(pathname, currentPathname, windowContext); | ||
}, [pathname, currentPathname, windowContext, resetScrollPosition]); | ||
|
||
return null; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.