Skip to content

Commit 8da5ef0

Browse files
committed
feat(): Adding all the sections navigation
1 parent 85a77a5 commit 8da5ef0

21 files changed

Lines changed: 1520 additions & 53 deletions

File tree

public/cursor.png

16.5 KB
Loading

src/components/Button/LinkButton/LinkButton.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const LinkButton = ({
1313
fontSize,
1414
}: LinkButtonProps) => {
1515
const ref = useRef<HTMLButtonElement>(null);
16-
const { toggle, setCursorInsets } = useCursor();
16+
const { setCursorInsets } = useCursor();
1717
const [isHovered, setIsHovered] = useState(false);
1818

1919
const onMouseEnter = () => {
@@ -28,14 +28,12 @@ const LinkButton = ({
2828
setTimeout(() => {
2929
setCursorInsets({ height, width, top, left, borderRadius: '5px' });
3030
}, 0);
31-
toggle();
3231
setIsHovered(true);
3332
};
3433

3534
const onMouseLeave = () => {
3635
setCursorInsets(undefined);
3736
setIsHovered(false);
38-
toggle();
3937
};
4038

4139
const translationProps = isHovered

src/components/CoverText/CoverText.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Heading } from '@chakra-ui/react';
22
import { Cover } from './Cover';
3+
import { ShinyText } from '../ShinyText';
34

45
const CoverText = ({
56
text,
@@ -15,8 +16,8 @@ const CoverText = ({
1516
<Heading className="text-2xl md:text-4xl lg:text-6xl font-semibold max-w-7xl mx-auto mt-6 relative z-20 py-6 bg-clip-text text-transparent bg-gradient-to-b from-neutral-800 via-neutral-700 to-neutral-700 dark:from-neutral-800 dark:via-white dark:to-white">
1617
<h2 className="text-xl md:text-3xl lg:text-4xl pb-6">{text}</h2>
1718
<Cover>{highlightedText}</Cover>
18-
<h2 className="text-xl md:text-3xl lg:text-4xl pt-6">{role}</h2>
1919
</Heading>
20+
<ShinyText className="text-xl md:text-3xl lg:text-6xl pt-2" text={role} />
2021
</Box>
2122
);
2223
};

src/components/Cursor/CursorProvider.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { createContext, useContext, useState } from 'react';
2-
import FollowCursor from './Cursor';
2+
import FollowCursor from './FollowCursor';
3+
import SplashCursor from './SplashCursor';
4+
5+
export type CursorType = 'follow' | 'splash';
36

47
export const CursorContext = createContext<{
5-
cursorState: boolean;
68
insets:
79
| {
810
height: number;
@@ -12,7 +14,7 @@ export const CursorContext = createContext<{
1214
borderRadius?: string;
1315
}
1416
| undefined;
15-
toggle: () => void;
17+
setCursorType: (type: CursorType) => void;
1618
setCursorInsets: (
1719
args:
1820
| {
@@ -25,10 +27,9 @@ export const CursorContext = createContext<{
2527
| undefined,
2628
) => void;
2729
}>({
28-
cursorState: true,
2930
insets: undefined,
3031
// eslint-disable-next-line @typescript-eslint/no-empty-function
31-
toggle: () => {},
32+
setCursorType: (type: CursorType) => {},
3233
setCursorInsets: (
3334
args:
3435
| {
@@ -44,7 +45,7 @@ export const CursorContext = createContext<{
4445
});
4546

4647
const CursorProvider = ({ children }: { children: React.ReactNode }) => {
47-
const [cursorState, setCursorState] = useState(true);
48+
const [cursorType, setCursorTypeState] = useState<CursorType>('follow');
4849
const [insets, setCursorSize] = useState<
4950
| {
5051
height: number;
@@ -56,8 +57,8 @@ const CursorProvider = ({ children }: { children: React.ReactNode }) => {
5657
| undefined
5758
>(undefined);
5859

59-
const toggle = () => {
60-
setCursorState((prev) => !prev);
60+
const setCursorType = (type: CursorType) => {
61+
setCursorTypeState(type);
6162
};
6263

6364
const setCursorInsets = (
@@ -75,9 +76,13 @@ const CursorProvider = ({ children }: { children: React.ReactNode }) => {
7576

7677
return (
7778
<CursorContext.Provider
78-
value={{ cursorState, insets, toggle, setCursorInsets }}
79+
value={{
80+
insets,
81+
setCursorType,
82+
setCursorInsets,
83+
}}
7984
>
80-
<FollowCursor />
85+
{cursorType === 'splash' ? <SplashCursor /> : <FollowCursor />}
8186
{children}
8287
</CursorContext.Provider>
8388
);
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { motion } from 'framer-motion';
22
import { useEffect, useRef } from 'react';
3-
import { useSpringMousePosition } from '../../hooks';
3+
import { useMousePositions, useSpringMousePosition } from '../../hooks';
44
import { useCursor } from './CursorProvider';
55

66
const FollowCursor = () => {
@@ -9,8 +9,8 @@ const FollowCursor = () => {
99
const { x, y } = useSpringMousePosition(ref);
1010

1111
const { width, height, top, left, borderRadius } = insets ?? {
12-
width: 56,
13-
height: 56,
12+
width: 32,
13+
height: 32,
1414
top: 0,
1515
left: 0,
1616
borderRadius: '5px',
@@ -25,7 +25,6 @@ const FollowCursor = () => {
2525

2626
useEffect(() => {
2727
// Initial position
28-
2928
ref.current!.style.transform = `translate(${x}px, ${y}px)`;
3029
}, [x, y, insets]);
3130

0 commit comments

Comments
 (0)