diff --git a/app/components/confetti.tsx b/app/components/confetti.tsx index 12bc6c4..15ac5d5 100644 --- a/app/components/confetti.tsx +++ b/app/components/confetti.tsx @@ -1,6 +1,6 @@ import { Index as ConfettiShower } from 'confetti-react' import { ClientOnly } from 'remix-utils' -import { useWindowSize } from '@uidotdev/usehooks' +import { useState, useEffect } from 'react' /** * confetti is a unique random identifier which re-renders the component @@ -22,3 +22,32 @@ export function Confetti({ confetti }: { confetti?: string }) { ) } + +function useWindowSize() { + interface Size { + width: number | undefined + height: number | undefined + } + const [size, setSize] = useState({ + width: undefined, + height: undefined, + }) + + useEffect(() => { + const handleResize = () => { + setSize({ + width: window.innerWidth, + height: window.innerHeight, + }) + } + + handleResize() + window.addEventListener('resize', handleResize) + + return () => { + window.removeEventListener('resize', handleResize) + } + }, []) + + return size +} diff --git a/package-lock.json b/package-lock.json index 3149d57..6275e1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,6 @@ "@sentry/remix": "^7.54.0", "@tailwindcss/typography": "^0.5.10", "@tanstack/react-table": "^8.9.2", - "@uidotdev/usehooks": "^2.4.1", "address": "^1.2.2", "autoprefixer": "^10.4.14", "bcryptjs": "^2.4.3", @@ -5164,18 +5163,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@uidotdev/usehooks": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@uidotdev/usehooks/-/usehooks-2.4.1.tgz", - "integrity": "sha512-1I+RwWyS+kdv3Mv0Vmc+p0dPYH0DTRAo04HLyXReYBL9AeseDWUJyi4THuksBJcu9F0Pih69Ak150VDnqbVnXg==", - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "react": ">=18.0.0", - "react-dom": ">=18.0.0" - } - }, "node_modules/@vanilla-extract/babel-plugin-debug-ids": { "version": "1.0.3", "dev": true, @@ -20983,11 +20970,6 @@ } } }, - "@uidotdev/usehooks": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@uidotdev/usehooks/-/usehooks-2.4.1.tgz", - "integrity": "sha512-1I+RwWyS+kdv3Mv0Vmc+p0dPYH0DTRAo04HLyXReYBL9AeseDWUJyi4THuksBJcu9F0Pih69Ak150VDnqbVnXg==" - }, "@vanilla-extract/babel-plugin-debug-ids": { "version": "1.0.3", "dev": true, diff --git a/package.json b/package.json index 661662b..9028d6d 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "@sentry/remix": "^7.54.0", "@tailwindcss/typography": "^0.5.10", "@tanstack/react-table": "^8.9.2", - "@uidotdev/usehooks": "^2.4.1", "address": "^1.2.2", "autoprefixer": "^10.4.14", "bcryptjs": "^2.4.3",