-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from canopas/change-menus-flow
Redesign restaurants categories page
- Loading branch information
Showing
8 changed files
with
250 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useState } from "react"; | ||
import Image from "next/image"; | ||
|
||
const LoadImage = ({ src, alt }: { src: string; alt: string }) => { | ||
const [isLoaded, setIsLoaded] = useState(false); | ||
|
||
return ( | ||
<Image | ||
src={src} | ||
alt={alt} | ||
height={100} | ||
width={100} | ||
className={`w-full transition-opacity duration-[2000] ${ | ||
isLoaded ? "opacity-100" : "opacity-0" | ||
}`} | ||
onLoad={() => setIsLoaded(true)} | ||
/> | ||
); | ||
}; | ||
|
||
export default LoadImage; |
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,17 @@ | ||
import { useRef, useEffect } from "react"; | ||
|
||
const useScrollReset = (isOpen: boolean) => { | ||
const contentRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
console.log("ref called"); | ||
if (isOpen && contentRef.current) { | ||
console.log(contentRef.current.scrollTop); | ||
contentRef.current.scrollTop = 0; | ||
} | ||
}, [isOpen]); | ||
|
||
return contentRef; | ||
}; | ||
|
||
export default useScrollReset; |
Oops, something went wrong.