Skip to content

Commit 1bf2231

Browse files
committed
feat(): Adding the characters
1 parent 68a2fa3 commit 1bf2231

16 files changed

Lines changed: 774 additions & 26 deletions

File tree

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GENERATE_SOURCEMAP=false
2+

.eslintrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"eslint:recommended",
99
"plugin:@typescript-eslint/recommended",
1010
"plugin:react/recommended",
11+
"plugin:@react-three/recommended",
1112
"react-app"
12-
// "prettier" // prettier
1313
],
1414
"parserOptions": {
1515
"ecmaVersion": "latest",
1616
"sourceType": "module",
1717
"project": ["./tsconfig.json"]
1818
},
19-
"plugins": ["react"],
19+
"plugins": ["react", "@react-three"],
2020
"rules": {
2121
"react/react-in-jsx-scope": "off",
2222
"no-unused-vars": "off",

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
"@chakra-ui/react": "^2.8.2",
2727
"@emotion/react": "^11.11.4",
2828
"@emotion/styled": "^11.11.5",
29+
"@react-three/drei": "^9.121.2",
30+
"@react-three/fiber": "^8.17.12",
31+
"@react-three/postprocessing": "^2.16.6",
2932
"@testing-library/jest-dom": "^5.17.0",
3033
"@testing-library/react": "^13.4.0",
3134
"@testing-library/user-event": "^13.5.0",
@@ -35,6 +38,7 @@
3538
"@types/react-dom": "^18.2.22",
3639
"framer-motion": "^11.1.9",
3740
"fuse.js": "^7.0.0",
41+
"gsap": "^3.12.7",
3842
"i18next": "^23.11.2",
3943
"i18next-browser-languagedetector": "^7.2.1",
4044
"immer": "^10.0.4",
@@ -47,6 +51,7 @@
4751
"react-scripts": "5.0.1",
4852
"react-social-icons": "^6.16.0",
4953
"react-type-animation": "^3.2.0",
54+
"three": "^0.172.0",
5055
"typescript": "^4.9.5",
5156
"web-vitals": "^2.1.4",
5257
"zustand": "^4.5.2"
@@ -77,11 +82,13 @@
7782
"@craco/craco": "^7.1.0",
7883
"@craco/types": "^7.1.0",
7984
"@jest/globals": "^29.7.0",
85+
"@react-three/eslint-plugin": "^0.1.2",
8086
"@testing-library/jest-dom": "^5.17.0",
8187
"@testing-library/react": "^13.4.0",
8288
"@testing-library/user-event": "^13.5.0",
8389
"@types/jest": "^29.5.12",
8490
"@types/react-test-renderer": "^18.3.0",
91+
"@types/three": "^0.172.0",
8592
"babel-jest": "^29.7.0",
8693
"cypress": "^13.8.1",
8794
"eslint": "^8.0.1",

public/adamHead.glb

14 MB
Binary file not shown.

public/lieutenantHead.glb

15.9 MB
Binary file not shown.

src/components/Cursor/Cursor.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { motion } from 'framer-motion';
2-
import { useRef } from 'react';
2+
import { useEffect, useRef } from 'react';
33
import { useSpringMousePosition } from '../../hooks';
44
import { useCursor } from './CursorProvider';
55

@@ -23,6 +23,12 @@ const FollowCursor = () => {
2323
borderRadius: insets ? borderRadius ?? '5px' : '50%',
2424
};
2525

26+
useEffect(() => {
27+
// Initial position
28+
29+
ref.current!.style.transform = `translate(${x}px, ${y}px)`;
30+
}, [x, y, insets]);
31+
2632
return (
2733
<motion.div
2834
className="cursor"

src/components/Lights/Lights.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const Lights = () => {
66
<Box
77
position={'absolute'}
88
top={0}
9-
left={0}
9+
right={0}
1010
boxShadow={'0 0 40px 10px violet, 0 0 100px 40px violet'}
1111
/>
1212
<Box
1313
position={'absolute'}
14-
top={'50%'}
15-
right={-10}
14+
top={'30%'}
15+
left={-10}
1616
boxShadow={
1717
'0 0 40px 10px violet, 0 0 100px 20px violet, 0 0 140px 30px violet, 0 0 200px 40px violet, 0 0 300px 60px violet'
1818
}

src/screens/mainFlow/MainScreen.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { Text } from '@chakra-ui/react';
22
import { TitleBoxContainer, Lights } from '@components';
33
import { NavigationBar, SocialNavigation } from './components';
4+
import { RobotScene } from './scene';
5+
import { useState } from 'react';
46

57
const MainScreen = () => {
8+
const [characterType, setCharacterType] = useState<'adam' | 'lieutenant'>(
9+
'lieutenant',
10+
);
611
return (
712
<TitleBoxContainer
813
title={'Amit Raikwar | Portfolio'}
@@ -11,19 +16,14 @@ const MainScreen = () => {
1116
minW={'100vw'}
1217
display={'flex'}
1318
>
19+
<RobotScene type={characterType} />
1420
<Lights />
15-
<NavigationBar />
21+
<NavigationBar
22+
handleCharacterClick={(type: 'adam' | 'lieutenant') => {
23+
setCharacterType(type);
24+
}}
25+
/>
1626
<SocialNavigation />
17-
<Text
18-
fontSize={'4xl'}
19-
color={'white'}
20-
position={'absolute'}
21-
top={'50%'}
22-
left={'50%'}
23-
transform={'translate(-50%, -50%)'}
24-
>
25-
AMIT Raikwar
26-
</Text>
2727
</TitleBoxContainer>
2828
);
2929
};

src/screens/mainFlow/components/NavigationBar.tsx

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
import { HStack } from '@chakra-ui/react';
1+
import {
2+
Button,
3+
HStack,
4+
Menu,
5+
MenuButton,
6+
MenuItem,
7+
MenuList,
8+
Text,
9+
} from '@chakra-ui/react';
210
import { LinkButton } from '@components';
311

4-
const NavigationBar = () => {
12+
const NavigationBar = ({
13+
handleCharacterClick: handlerCharacterClick,
14+
}: {
15+
handleCharacterClick: (type: 'adam' | 'lieutenant') => void;
16+
}) => {
517
return (
618
<HStack
719
position={'fixed'}
@@ -40,6 +52,36 @@ const NavigationBar = () => {
4052
fontSize={'xl'}
4153
animationOnHover
4254
/>
55+
<Menu>
56+
<MenuButton>
57+
<LinkButton
58+
key={'more'}
59+
text={'Character'}
60+
href={'#more'}
61+
fontSize={'xl'}
62+
withUnderline
63+
/>
64+
</MenuButton>
65+
<MenuList
66+
style={{
67+
backgroundColor: 'transparent',
68+
color: 'violet',
69+
padding: '0px',
70+
boxShadow: '0px 0px 20px 8px violet',
71+
}}
72+
>
73+
<MenuItem onClick={() => handlerCharacterClick('adam')}>
74+
<Text key={'adam'} fontSize={'xl'}>
75+
Adam
76+
</Text>
77+
</MenuItem>
78+
<MenuItem onClick={() => handlerCharacterClick('lieutenant')}>
79+
<Text key={'Lieutenant'} fontSize={'xl'}>
80+
Lieutenant
81+
</Text>
82+
</MenuItem>
83+
</MenuList>
84+
</Menu>
4385
</HStack>
4486
</HStack>
4587
);

src/screens/mainFlow/components/SocialNavigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const SocialNavigation = () => {
4343
ref={ref}
4444
position={'fixed'}
4545
bottom={20}
46-
left={10}
46+
right={10}
4747
px={2}
4848
py={5}
4949
border={'1px solid white'}

0 commit comments

Comments
 (0)