Skip to content

Commit 4a69bf7

Browse files
committed
feat(): Adding the article screen
1 parent 44ca85d commit 4a69bf7

9 files changed

Lines changed: 106 additions & 65 deletions

File tree

src/hooks/useSpringMousePosition.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const useSpringMousePosition = (ref: RefObject<HTMLDivElement | null>) => {
1717
const element = ref.current!;
1818

1919
frame.read(() => {
20-
xPoint.jump(clientX - element.offsetLeft - 56 / 2);
21-
yPoint.jump(clientY - element.offsetTop - 56 / 2);
20+
xPoint.jump(clientX - element.offsetLeft - 32 / 2);
21+
yPoint.jump(clientY - element.offsetTop - 32 / 2);
2222
});
2323
};
2424

src/router/PublicRoutes.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ import {
44
createBrowserRouter,
55
createRoutesFromChildren,
66
} from 'react-router-dom';
7-
import { LazyMainScreen } from './lazyScreen';
7+
import {
8+
LazyArticlesScreen,
9+
LazyHostScreen,
10+
LazyMainScreen,
11+
} from './lazyScreen';
812

913
const publicRouter = createBrowserRouter(
1014
createRoutesFromChildren(
11-
<Route path="/" element={<LazyMainScreen />}>
12-
{/* Main screen routes. */}
13-
14-
{/* Main flow screen routes. */}
15+
<Route path="/" element={<LazyHostScreen />}>
16+
<Route path="" element={<LazyMainScreen />} />
17+
<Route path="articles" element={<LazyArticlesScreen />} />
1518
<Route path="*" element={<Navigate to="/" replace />} />
1619
</Route>,
1720
),

src/router/lazyScreen/LazyMainFlowScreen.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import { lazy } from 'react';
22
import { LazyComponentProvider } from '@providers';
33

4+
const HostScreen = lazy(() => import('@screens/host/Host'));
5+
6+
export const LazyHostScreen = () => {
7+
return (
8+
<LazyComponentProvider>
9+
<HostScreen />
10+
</LazyComponentProvider>
11+
);
12+
};
13+
414
const MainScreen = lazy(() => import('@screens/mainFlow/MainScreen'));
515

616
export const LazyMainScreen = () => {
@@ -10,3 +20,13 @@ export const LazyMainScreen = () => {
1020
</LazyComponentProvider>
1121
);
1222
};
23+
24+
const ArticlesScreen = lazy(() => import('@screens/articles/Articles'));
25+
26+
export const LazyArticlesScreen = () => {
27+
return (
28+
<LazyComponentProvider>
29+
<ArticlesScreen />
30+
</LazyComponentProvider>
31+
);
32+
};

src/screens/articles/Articles.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const Articles = () => {
2+
return (
3+
<div>
4+
<h1>Articles</h1>
5+
</div>
6+
);
7+
};
8+
9+
export default Articles;

src/screens/mainFlow/components/NavigationBar.tsx renamed to src/screens/common/NavigationBar.tsx

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import AmitRaikwarLogo from '@assets/images/AmitRaikwarLogo.png';
44
import { SearchIcon } from '@assets';
55
import { useRef } from 'react';
66
import { useTranslation } from 'react-i18next';
7+
import { useNavigate } from 'react-router-dom';
78

89
const NavigationLink = [
910
{
@@ -18,6 +19,10 @@ const NavigationLink = [
1819
name: 'navigation.about',
1920
href: 'about',
2021
},
22+
{
23+
name: 'navigation.contact',
24+
href: 'contact',
25+
},
2126
];
2227

2328
const ArticleLink = {
@@ -26,6 +31,7 @@ const ArticleLink = {
2631
};
2732

2833
const NavigationBar = () => {
34+
const navigate = useNavigate();
2935
const { t } = useTranslation();
3036
const ref = useRef<HTMLDivElement>(null);
3137
const { setCursorInsets } = useCursor();
@@ -56,52 +62,29 @@ const NavigationBar = () => {
5662
};
5763

5864
return (
59-
<>
65+
<HStack
66+
position={'fixed'}
67+
marginY={{ md: 2, xl: 4 }}
68+
width={'100%'}
69+
paddingRight={14}
70+
paddingLeft={{ base: 14, '2xl': 32 }}
71+
zIndex={1000}
72+
justifyContent={'space-between'}
73+
>
74+
<Img
75+
src={AmitRaikwarLogo}
76+
alt={'logo'}
77+
w={8}
78+
h={6}
79+
onClick={() => navigate('/')}
80+
_hover={{
81+
transform: 'scale(1.3)',
82+
transition: 'transform 0.5s',
83+
cursor: 'pointer',
84+
}}
85+
/>
6086
<HStack
61-
position={'fixed'}
62-
marginY={{ md: 4, xl: 6 }}
63-
w={'100%'}
64-
paddingRight={14}
65-
paddingLeft={{ base: 14, '2xl': 32 }}
6687
zIndex={1000}
67-
justifyContent={'space-between'}
68-
>
69-
<Img
70-
src={AmitRaikwarLogo}
71-
alt={'logo'}
72-
w={8}
73-
h={6}
74-
_hover={{
75-
transform: 'scale(1.3)',
76-
transition: 'transform 0.5s',
77-
cursor: 'pointer',
78-
}}
79-
/>
80-
<HStack>
81-
<HStack
82-
border={'1px solid gray'}
83-
padding="2.5"
84-
color={'white'}
85-
borderRadius="100px"
86-
bg={'rgba(255, 255, 255, 0.1)'}
87-
backdropFilter={'blur(20px)'}
88-
transition={'all 0.3s'}
89-
_hover={{
90-
transform: 'scale(1.1)',
91-
cursor: 'pointer',
92-
}}
93-
onMouseEnter={onMouseEnter}
94-
onMouseLeave={onMouseLeave}
95-
ref={ref}
96-
onClick={() => {}} // eslint-disable-line
97-
>
98-
<SearchIcon />
99-
</HStack>
100-
</HStack>
101-
</HStack>
102-
<HStack
103-
zIndex={1000}
104-
position={'fixed'}
10588
columnGap={3}
10689
top={6}
10790
border={'1px solid gray'}
@@ -121,13 +104,6 @@ const NavigationBar = () => {
121104
onClick={() => scrollToComponent(href)}
122105
/>
123106
))}
124-
<LinkButton
125-
key={ArticleLink.name}
126-
text={t(ArticleLink.name)}
127-
href={ArticleLink.href}
128-
fontSize={'lg'}
129-
animationOnHover
130-
/>
131107
<Box
132108
padding="0.2"
133109
borderRadius="100px"
@@ -136,14 +112,34 @@ const NavigationBar = () => {
136112
transition={'background-color 0.3s'}
137113
>
138114
<LinkButton
139-
key={'Contact'}
140-
text={t('navigation.contact')}
141-
href={'#contact'}
115+
key={ArticleLink.name}
116+
text={t(ArticleLink.name)}
117+
href={ArticleLink.href}
142118
fontSize={'lg'}
119+
animationOnHover
143120
/>
144121
</Box>
145122
</HStack>
146-
</>
123+
<HStack
124+
border={'1px solid gray'}
125+
padding="2.5"
126+
color={'white'}
127+
borderRadius="100px"
128+
bg={'rgba(255, 255, 255, 0.1)'}
129+
backdropFilter={'blur(20px)'}
130+
transition={'all 0.3s'}
131+
_hover={{
132+
transform: 'scale(1.1)',
133+
cursor: 'pointer',
134+
}}
135+
onMouseEnter={onMouseEnter}
136+
onMouseLeave={onMouseLeave}
137+
ref={ref}
138+
onClick={() => {}} // eslint-disable-line
139+
>
140+
<SearchIcon />
141+
</HStack>
142+
</HStack>
147143
);
148144
};
149145

src/screens/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as NavigationBar } from './NavigationBar';

src/screens/host/Host.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Box } from '@chakra-ui/react';
2+
import { NavigationBar } from '@screens/common';
3+
import { Outlet } from 'react-router-dom';
4+
5+
const Host = () => {
6+
return (
7+
<Box width={'100vw'} height={'100%'}>
8+
<NavigationBar />
9+
<Outlet />
10+
</Box>
11+
);
12+
};
13+
14+
export default Host;

src/screens/mainFlow/MainScreen.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TitleBoxContainer } from '@components';
2-
import { Footer, NavigationBar } from './components';
2+
import { Footer } from './components';
33
import { Contents } from './contents';
44
import { CoverContent } from './CoverContent';
55

@@ -13,7 +13,6 @@ const MainScreen = () => {
1313
flexDir={'column'}
1414
alignItems={'center'}
1515
>
16-
<NavigationBar />
1716
<CoverContent />
1817
<Contents />
1918
<Footer />
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
export { default as NavigationBar } from './NavigationBar';
21
export { default as SocialNavigation } from './SocialNavigation';
32
export { default as Footer } from './Footer';

0 commit comments

Comments
 (0)