diff --git a/package.json b/package.json index d6c6d24..12bfeb6 100644 --- a/package.json +++ b/package.json @@ -16,10 +16,12 @@ "@types/node": "^16.7.13", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", + "clsx": "^2.1.1", "date-fns": "^3.6.0", "framer-motion": "^11.1.7", "graphql": "^16.8.1", "katex": "^0.16.10", + "mini-svg-data-uri": "^1.4.4", "react": "^18.3.1", "react-dom": "^18.3.1", "react-ga4": "^2.1.0", @@ -29,6 +31,7 @@ "react-scripts": "5.0.1", "react-syntax-highlighter": "^15.5.0", "recharts": "^2.12.6", + "tailwind-merge": "^2.3.0", "typescript": "^4.4.2", "web-vitals": "^2.1.0" }, diff --git a/src/components/BackgroundDots.tsx b/src/components/BackgroundDots.tsx new file mode 100644 index 0000000..c2af13c --- /dev/null +++ b/src/components/BackgroundDots.tsx @@ -0,0 +1,70 @@ +import React from 'react' +import { cn } from '../utils/cn' +import { + useMotionValue, + motion, + useMotionTemplate, +} from 'framer-motion' + +export type BackgroundDotsProps = { + children: React.ReactNode + className?: string + containerClassName?: string +} + +const BackgroundDots: React.FC = ({ + children, + className, + containerClassName, +}) => { + let mouseX = useMotionValue(0) + let mouseY = useMotionValue(0) + + const handleMouseMove = ({ + currentTarget, + clientX, + clientY, + }: React.MouseEvent) => { + if (!currentTarget) return + let { left, top } = currentTarget.getBoundingClientRect() + mouseX.set(clientX - left) + mouseY.set(clientY - top) + } + + return ( +
+
+ + +
+ {children} +
+
+ ) +} + +export default BackgroundDots diff --git a/src/components/Page.tsx b/src/components/Page.tsx index ba8bfc4..6b569e4 100644 --- a/src/components/Page.tsx +++ b/src/components/Page.tsx @@ -4,6 +4,7 @@ import Footer from './Footer' import { useLocation } from 'react-router-dom' import { Helmet } from 'react-helmet' import ReactGA from 'react-ga4' +import BackgroundDots from './BackgroundDots' export type PageProps = { children: React.ReactNode @@ -26,9 +27,11 @@ const Page: React.FC = ({ children, active, title }) => { {title ?? 'Ammar Ahmed'} -
- {children} -
+ +
+ {children} +
+