Skip to content

Commit d6a84ee

Browse files
committed
feat(): Adding the loading screen
1 parent 4008b04 commit d6a84ee

15 files changed

Lines changed: 71 additions & 65 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"no-irregular-whitespace": "off",
3434
"react/no-children-prop": "off",
3535
"@typescript-eslint/no-explicit-any": "off",
36-
"@typescript-eslint/no-unused-vars": "off",
36+
"@typescript-eslint/no-unused-vars": "error",
3737
"@typescript-eslint/no-non-null-assertion": "off",
3838
"@typescript-eslint/ban-types": "off",
3939
"@typescript-eslint/no-var-requires": "off"

src/components/CoverText/Sparkle.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useId, useMemo } from 'react';
1+
import { useId } from 'react';
22
import { useEffect, useState } from 'react';
33
import Particles, { initParticlesEngine } from '@tsparticles/react';
44
import type { Container, SingleOrMultiple } from '@tsparticles/engine';
@@ -19,7 +19,6 @@ type ParticlesProps = {
1919
export const SparklesCore = (props: ParticlesProps) => {
2020
const {
2121
id,
22-
className,
2322
background,
2423
minSize,
2524
maxSize,

src/components/Cursor/CursorProvider.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createContext, useContext, useState } from 'react';
22
import FollowCursor from './FollowCursor';
3-
import SplashCursor from './SplashCursor';
43

54
export type CursorType = 'follow' | 'splash';
65

src/components/Marquee/__tests__/Marquee.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fireEvent, render } from '@testing-library/react';
1+
import { render } from '@testing-library/react';
22
import Marquee from '../Marquee';
33

44
describe('Marquee', () => {

src/hooks/useMoveToTop.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
const useMoveToTop = () => {
22
const moveToTopOfPage = () => {
33
// Make it scroll to the top of the page slowly.
4-
window.scrollTo(0, 0);
4+
window.scrollTo({
5+
top: 0,
6+
behavior: 'smooth',
7+
});
58
};
69

710
return moveToTopOfPage;

src/hooks/useSpringMousePosition.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMotionValue, useSpring, spring, frame } from 'framer-motion';
1+
import { useMotionValue, useSpring, frame } from 'framer-motion';
22
import { RefObject, useEffect } from 'react';
33
import { SPRING_SETTING } from './constants';
44

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
11
import * as React from 'react';
22
import { LazyComponentProviderProps } from './types';
3+
import { Box, CircularProgress, Text } from '@chakra-ui/react';
4+
5+
const LoadingScreen = () => {
6+
return (
7+
<Box
8+
style={{
9+
display: 'flex',
10+
flexDirection: 'column',
11+
justifyContent: 'center',
12+
alignItems: 'center',
13+
height: '100vh',
14+
backgroundColor: '#000000',
15+
rowGap: '1rem',
16+
}}
17+
>
18+
<CircularProgress isIndeterminate color="violet" />
19+
<Text color="white" fontSize="lg" fontWeight="bold" textAlign="center">
20+
Loading...
21+
</Text>
22+
</Box>
23+
);
24+
};
325

426
const LazyComponentProvider = (props: LazyComponentProviderProps) => {
5-
return <React.Suspense fallback={<></>}>{props.children}</React.Suspense>;
27+
return (
28+
<React.Suspense fallback={<LoadingScreen />}>
29+
{props.children}
30+
</React.Suspense>
31+
);
632
};
733

834
export default LazyComponentProvider;

src/screens/common/NavigationBar.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Box, HStack, Img, Kbd } from '@chakra-ui/react';
1+
import { Box, HStack, Img } from '@chakra-ui/react';
22
import { LinkButton, useCursor } from '@components';
33
import AmitRaikwarLogo from '@assets/images/AmitRaikwarLogo.png';
44
import { SearchIcon } from '@assets';
55
import { useRef } from 'react';
66
import { useTranslation } from 'react-i18next';
77
import { useLocation, useNavigate } from 'react-router-dom';
8+
import { useMoveToTop } from '@hooks';
89

910
const NavigationLink = [
1011
{
@@ -31,6 +32,7 @@ const ArticleLink = {
3132
};
3233

3334
const NavigationBar = () => {
35+
const moveToTop = useMoveToTop();
3436
const location = useLocation();
3537
const pathName = location.pathname;
3638
const navigate = useNavigate();
@@ -77,7 +79,10 @@ const NavigationBar = () => {
7779
src={AmitRaikwarLogo}
7880
alt={'logo'}
7981
w={8}
80-
onClick={() => navigate('/')}
82+
onClick={() => {
83+
navigate('/');
84+
moveToTop();
85+
}}
8186
_hover={{
8287
transform: 'scale(1.3)',
8388
transition: 'transform 0.5s',

src/screens/mainFlow/contents/AboutMe.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Heading, HStack, VStack } from '@chakra-ui/react';
1+
import { Heading, VStack } from '@chakra-ui/react';
22
import { useCursor } from '@components';
33
import { useIsIntersecting } from '@hooks';
44
import { useEffect, useRef } from 'react';
@@ -24,9 +24,13 @@ const AboutMe = () => {
2424
id="about"
2525
width={'99vw'}
2626
paddingX={32}
27-
paddingY={24}
2827
>
29-
<Heading width={'100%'} textAlign={'start'}>
28+
<Heading
29+
width={'100%'}
30+
textAlign={'start'}
31+
position={'sticky'}
32+
top={'10vh'}
33+
>
3034
{t('about.title')}
3135
</Heading>
3236
<TextGenerateEffect words={t('about.aboutMe')} />

src/screens/mainFlow/contents/Contact.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import { useTranslation } from 'react-i18next';
44
const Contact = () => {
55
const { t } = useTranslation();
66
return (
7-
<Box minH={'100vh'} id="contact" paddingTop={24} rowGap={10}>
8-
<Heading textAlign={'start'}>{t('contact.title')}</Heading>
7+
<Box minH={'100vh'} width={'99vw'} id="contact" paddingX={32}>
8+
<Heading textAlign={'start'} position={'sticky'} top={'10vh'}>
9+
{t('contact.title')}
10+
</Heading>
911
<HStack></HStack>
1012
</Box>
1113
);

0 commit comments

Comments
 (0)