Skip to content

Commit

Permalink
fix: minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bhoopesh369 committed Dec 8, 2023
1 parent a95a21c commit 0fa9dcf
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 53 deletions.
3 changes: 2 additions & 1 deletion src/app/gallery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ const History = () => {
styles.historyBG +
' ' +
'h-screen w-screen p-0 flex justify-center items-center overflow-y-hidden' +
(isScrolled ? 'scrolled' : '')
' ' +
(isScrolled ? ' scrolled' : ' transitioned')
}
onWheel={simulateScroll}
onTouchStart={handleTouchStart}
Expand Down
2 changes: 1 addition & 1 deletion src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ body {
background-color: initial;
}
to {
background-color: #7efbfe;
background-color: #000;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function Home() {
}
></div>
<div
className={'h-screen w-full text-center lg:p-7 p-5 home'}
className={'h-screen w-full text-center lg:p-7 p-5 home transitioned'}
onWheel={simulateScroll}
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
Expand Down
73 changes: 25 additions & 48 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,7 @@ const generateRandomNumber = (length: number) => {
return result;
};

function useWindowSize() {
const [windowSize, setWindowSize] = useState<{
width: number | undefined;
height: number | undefined;
}>({
width: undefined,
height: undefined,
});

useEffect(() => {
function handleResize() {
setWindowSize({
width: window.innerWidth,
height: window.innerHeight,
});
}
window.addEventListener('resize', handleResize);
handleResize();
return () => window.removeEventListener('resize', handleResize);
}, []);
return windowSize;
}

export default function Loading() {
const size = useWindowSize();
const currDate = new Date();
const [animationStarted, setAnimationStarted] = useState<boolean>(false);
const [year, setYear] = useState(String(currDate.getFullYear()).padStart(4, '0'));
Expand Down Expand Up @@ -87,8 +63,8 @@ export default function Loading() {
clearInterval(lightTimer);
setTimeout(() => {
router.push('/home');
}, 1000);
}, 5000);
}, 500);
}, 2000);
const lightTimer = setInterval(() => {
setIsLeftLightOn(prev => !prev);
}, 100);
Expand All @@ -100,27 +76,28 @@ export default function Loading() {
}
}, [animationStarted, router]);

return size.width !== undefined && size.width < 700 ? (
<LoadingMobileView
month={month}
year={year}
date={date}
hours={hours}
minutes={minutes}
isButtonClicked={animationStarted}
setClicked={setAnimationStarted}
isLeftLightOn={isLeftLightOn}
/>
) : (
<LoadingWebView
month={month}
year={year}
date={date}
hours={hours}
minutes={minutes}
isButtonClicked={animationStarted}
setClicked={setAnimationStarted}
isLeftLightOn={isLeftLightOn}
/>
return (
<>
<LoadingMobileView
month={month}
year={year}
date={date}
hours={hours}
minutes={minutes}
isButtonClicked={animationStarted}
setClicked={setAnimationStarted}
isLeftLightOn={isLeftLightOn}
/>
<LoadingWebView
month={month}
year={year}
date={date}
hours={hours}
minutes={minutes}
isButtonClicked={animationStarted}
setClicked={setAnimationStarted}
isLeftLightOn={isLeftLightOn}
/>
</>
);
}
2 changes: 1 addition & 1 deletion src/components/Landing/LoadingMobileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const LoadingMobileView = ({
}: LoadingProps) => {
return (
<>
<div className="relative w-[100vw] h-[100vh] bg-[#0D0D0D] flex flex-col items-center justify-center bg-[url('../assets/images/loadingBgMobile.png')] bg-contain bg-center bg-no-repeat">
<div className="relative md:hidden w-[100vw] h-[100vh] bg-[#0D0D0D] flex flex-col items-center justify-center bg-[url('../assets/images/loadingBgMobile.png')] bg-contain bg-center bg-no-repeat">
<div className=" h-[20%] w-[80%] relative flex flex-col items-center justify-center">
<div className="absolute flex w-[10%] right-[10vw] top-[4.2vh] max-[380px]:right-[15vw]">
<Image src={isLeftLightOn ? onlight : offLight} alt="light" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Landing/LoadingWebView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const LoadingWebView = ({
}: LoadingProps) => {
return (
<>
<div className="w-[100vw] h-[100vh] bg-[#0D0D0D] relative">
<div className="max-md:hidden w-[100vw] h-[100vh] bg-[#0D0D0D] relative">
<div className="relative left-[50%] top-[50%] transform -translate-x-1/2 -translate-y-1/2 h-[90%] w-[100%] flex flex-col items-center justify-center bg-[url('../assets/images/loadingBg.png')] bg-contain bg-center bg-no-repeat">
<div className=" w-[80%] h-[28%] loadingdivs relative flex items-center justify-end">
<div className=" mr-[2%] flex w-[10%] h-[100%] items-end 2xl:h-[100%] lights">
Expand Down

0 comments on commit 0fa9dcf

Please sign in to comment.