Skip to content

Commit 68a2fa3

Browse files
committed
feat(): Adding social navigation bar
1 parent ca9111d commit 68a2fa3

11 files changed

Lines changed: 131 additions & 4 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { SVGProps } from 'react';
2+
const GithubIcon = (props: SVGProps<SVGSVGElement>) => (
3+
<svg
4+
width="1em"
5+
height="1em"
6+
fill="currentColor"
7+
viewBox="0 0 16 16"
8+
{...props}
9+
>
10+
<path d="M8 .198a8 8 0 0 0-2.529 15.591c.4.074.547-.174.547-.385 0-.191-.008-.821-.011-1.489-2.226.484-2.695-.944-2.695-.944-.364-.925-.888-1.171-.888-1.171-.726-.497.055-.486.055-.486.803.056 1.226.824 1.226.824.714 1.223 1.872.869 2.328.665.072-.517.279-.87.508-1.07-1.777-.202-3.645-.888-3.645-3.954 0-.873.313-1.587.824-2.147-.083-.202-.357-1.015.077-2.117 0 0 .672-.215 2.201.82A7.672 7.672 0 0 1 8 4.066c.68.003 1.365.092 2.004.269 1.527-1.035 2.198-.82 2.198-.82.435 1.102.162 1.916.079 2.117.513.56.823 1.274.823 2.147 0 3.073-1.872 3.749-3.653 3.947.287.248.543.735.543 1.481 0 1.07-.009 1.932-.009 2.195 0 .213.144.462.55.384A8 8 0 0 0 8.001.196z" />
11+
</svg>
12+
);
13+
export default GithubIcon;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { SVGProps } from 'react';
2+
const InstagramIcon = (props: SVGProps<SVGSVGElement>) => (
3+
<svg
4+
width="1em"
5+
height="1em"
6+
fill="currentColor"
7+
viewBox="0 0 16 16"
8+
{...props}
9+
>
10+
<path d="M8 0C5.829 0 5.556.01 4.703.048 3.85.088 3.269.222 2.76.42a3.9 3.9 0 0 0-1.417.923A3.9 3.9 0 0 0 .42 2.76C.222 3.268.087 3.85.048 4.7.01 5.555 0 5.827 0 8.001c0 2.172.01 2.444.048 3.297.04.852.174 1.433.372 1.942.205.526.478.972.923 1.417.444.445.89.719 1.416.923.51.198 1.09.333 1.942.372C5.555 15.99 5.827 16 8 16s2.444-.01 3.298-.048c.851-.04 1.434-.174 1.943-.372a3.9 3.9 0 0 0 1.416-.923c.445-.445.718-.891.923-1.417.197-.509.332-1.09.372-1.942C15.99 10.445 16 10.173 16 8s-.01-2.445-.048-3.299c-.04-.851-.175-1.433-.372-1.941a3.9 3.9 0 0 0-.923-1.417A3.9 3.9 0 0 0 13.24.42c-.51-.198-1.092-.333-1.943-.372C10.443.01 10.172 0 7.998 0zm-.717 1.442h.718c2.136 0 2.389.007 3.232.046.78.035 1.204.166 1.486.275.373.145.64.319.92.599s.453.546.598.92c.11.281.24.705.275 1.485.039.843.047 1.096.047 3.231s-.008 2.389-.047 3.232c-.035.78-.166 1.203-.275 1.485a2.5 2.5 0 0 1-.599.919c-.28.28-.546.453-.92.598-.28.11-.704.24-1.485.276-.843.038-1.096.047-3.232.047s-2.39-.009-3.233-.047c-.78-.036-1.203-.166-1.485-.276a2.5 2.5 0 0 1-.92-.598 2.5 2.5 0 0 1-.6-.92c-.109-.281-.24-.705-.275-1.485-.038-.843-.046-1.096-.046-3.233s.008-2.388.046-3.231c.036-.78.166-1.204.276-1.486.145-.373.319-.64.599-.92s.546-.453.92-.598c.282-.11.705-.24 1.485-.276.738-.034 1.024-.044 2.515-.045zm4.988 1.328a.96.96 0 1 0 0 1.92.96.96 0 0 0 0-1.92m-4.27 1.122a4.109 4.109 0 1 0 0 8.217 4.109 4.109 0 0 0 0-8.217m0 1.441a2.667 2.667 0 1 1 0 5.334 2.667 2.667 0 0 1 0-5.334" />
11+
</svg>
12+
);
13+
14+
export default InstagramIcon;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { SVGProps } from 'react';
2+
const LinkedInIcon = (props: SVGProps<SVGSVGElement>) => (
3+
<svg
4+
width="1em"
5+
height="1em"
6+
fill="currentColor"
7+
viewBox="0 0 900 1000"
8+
{...props}
9+
>
10+
<path d="M204 152c0 26.667-9.667 49.333-29 68s-44.333 28-75 28c-29.333 0-53.333-9.333-72-28S0 178.667 0 152c0-28 9.333-51 28-69s43.333-27 74-27 55 9 73 27 27.667 41 29 69M6 942V324h192v618H6m306-420c0-57.333-1.333-123.333-4-198h166l10 86h4c40-66.667 103.333-100 190-100 66.667 0 120.333 22.333 161 67s61 111 61 199v366H708V600c0-89.333-32.667-134-98-134-46.667 0-79.333 24-98 72-4 8-6 24-6 48v356H312V522" />
11+
</svg>
12+
);
13+
export default LinkedInIcon;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { SVGProps } from 'react';
2+
const MediumIcon = (props: SVGProps<SVGSVGElement>) => (
3+
<svg
4+
width="1em"
5+
height="1em"
6+
fill="currentColor"
7+
viewBox="0 0 16 16"
8+
{...props}
9+
>
10+
<path d="M9.025 8c0 2.485-2.02 4.5-4.513 4.5A4.506 4.506 0 0 1 0 8c0-2.486 2.02-4.5 4.512-4.5A4.506 4.506 0 0 1 9.025 8m4.95 0c0 2.34-1.01 4.236-2.256 4.236S9.463 10.339 9.463 8c0-2.34 1.01-4.236 2.256-4.236S13.975 5.661 13.975 8M16 8c0 2.096-.355 3.795-.794 3.795-.438 0-.793-1.7-.793-3.795 0-2.096.355-3.795.794-3.795.438 0 .793 1.699.793 3.795" />
11+
</svg>
12+
);
13+
export default MediumIcon;

src/assets/icons/Common/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ export { SearchIcon } from './Search';
22
export { ThreeDIcon } from './3D';
33
export { TwoDIcon } from './2D';
44
export { default as ArrowIcon } from './ArrowIcon';
5+
export { default as LinkedInIcon } from './LinkedInIcon';
6+
export { default as GithubIcon } from './GithubIcon';
7+
export { default as MediumIcon } from './MediumIcon';
8+
export { default as InstagramIcon } from './InstagramIcon';

src/components/Button/LinkButton/LinkButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const LinkButton = ({
2727
};
2828
setCursorInsets(undefined);
2929
setTimeout(() => {
30-
setCursorInsets({ height, width, top, left });
30+
setCursorInsets({ height, width, top, left, borderRadius: '5px' });
3131
}, 0);
3232
toggle();
3333
setIsHovered(true);

src/components/Cursor/Cursor.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ const FollowCursor = () => {
88
const ref = useRef<HTMLDivElement>(null);
99
const { x, y } = useSpringMousePosition(ref);
1010

11-
const { width, height, top, left } = insets ?? {
11+
const { width, height, top, left, borderRadius } = insets ?? {
1212
width: 56,
1313
height: 56,
1414
top: 0,
1515
left: 0,
16+
borderRadius: '5px',
1617
};
1718
const props = {
1819
boxShadow: '0 0 50px 10px violet',
1920
width: width,
2021
height: height,
2122
transition: !insets ? 'all 0.0s ease' : 'all 0.5s ease',
22-
borderRadius: insets ? '5px' : '50%',
23+
borderRadius: insets ? borderRadius ?? '5px' : '50%',
2324
};
2425

2526
return (

src/components/Cursor/CursorProvider.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const CursorContext = createContext<{
99
width: number;
1010
top: number;
1111
left: number;
12+
borderRadius?: string;
1213
}
1314
| undefined;
1415
toggle: () => void;
@@ -19,6 +20,7 @@ export const CursorContext = createContext<{
1920
width: number;
2021
top: number;
2122
left: number;
23+
borderRadius?: string;
2224
}
2325
| undefined,
2426
) => void;
@@ -34,6 +36,7 @@ export const CursorContext = createContext<{
3436
width: number;
3537
top: number;
3638
left: number;
39+
borderRadius?: string;
3740
}
3841
| undefined,
3942
// eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -48,6 +51,7 @@ const CursorProvider = ({ children }: { children: React.ReactNode }) => {
4851
width: number;
4952
top: number;
5053
left: number;
54+
borderRadius?: string;
5155
}
5256
| undefined
5357
>(undefined);

src/screens/mainFlow/MainScreen.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Text } from '@chakra-ui/react';
22
import { TitleBoxContainer, Lights } from '@components';
3-
import { NavigationBar } from './components';
3+
import { NavigationBar, SocialNavigation } from './components';
44

55
const MainScreen = () => {
66
return (
@@ -13,6 +13,7 @@ const MainScreen = () => {
1313
>
1414
<Lights />
1515
<NavigationBar />
16+
<SocialNavigation />
1617
<Text
1718
fontSize={'4xl'}
1819
color={'white'}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import {
2+
GithubIcon,
3+
InstagramIcon,
4+
LinkedInIcon,
5+
MediumIcon,
6+
SunIcon,
7+
} from '@assets';
8+
import { IconButton, transition, VStack } from '@chakra-ui/react';
9+
import { useCursor } from '@components';
10+
import { useRef } from 'react';
11+
12+
const IconProps = {
13+
variant: 'ghost',
14+
color: 'white',
15+
transition: 'transform 0.3s',
16+
transform: 'scale(1.5)',
17+
_hover: {
18+
transform: 'scale(2.2)',
19+
},
20+
};
21+
22+
const SocialNavigation = () => {
23+
const ref = useRef<HTMLDivElement>(null);
24+
const { setCursorInsets } = useCursor();
25+
const onMouseEnter = () => {
26+
const { width, height, top, left } =
27+
ref.current?.getBoundingClientRect() || {
28+
width: 56,
29+
height: 56,
30+
top: 0,
31+
left: 0,
32+
};
33+
setCursorInsets(undefined);
34+
setTimeout(() => {
35+
setCursorInsets({ height, width, top, left, borderRadius: '30px' });
36+
}, 0);
37+
};
38+
const onMouseLeave = () => {
39+
setCursorInsets(undefined);
40+
};
41+
return (
42+
<VStack
43+
ref={ref}
44+
position={'fixed'}
45+
bottom={20}
46+
left={10}
47+
px={2}
48+
py={5}
49+
border={'1px solid white'}
50+
borderRadius={'30px'}
51+
outline={'1px solid violet'}
52+
onMouseEnter={onMouseEnter}
53+
onMouseLeave={onMouseLeave}
54+
>
55+
<IconButton aria-label="" icon={<GithubIcon />} {...IconProps} />
56+
<IconButton icon={<LinkedInIcon />} aria-label="" {...IconProps} />
57+
<IconButton icon={<MediumIcon />} aria-label="" {...IconProps} />
58+
<IconButton icon={<InstagramIcon />} aria-label="" {...IconProps} />
59+
</VStack>
60+
);
61+
};
62+
63+
export default SocialNavigation;

0 commit comments

Comments
 (0)