this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove usehooks dep

In the end, only used one hook out of so many hooks

+29 -16
-14
package-lock.json
··· 15 15 "@iconify-icons/mingcute": "~1.2.9", 16 16 "@justinribeiro/lite-youtube": "~1.5.0", 17 17 "@szhsin/react-menu": "~4.1.0", 18 - "@uidotdev/usehooks": "~2.4.1", 19 18 "compare-versions": "~6.1.0", 20 19 "dayjs": "~1.11.11", 21 20 "dayjs-twitter": "~0.5.0", ··· 3885 3884 "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", 3886 3885 "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", 3887 3886 "dev": true 3888 - }, 3889 - "node_modules/@uidotdev/usehooks": { 3890 - "version": "2.4.1", 3891 - "resolved": "https://registry.npmjs.org/@uidotdev/usehooks/-/usehooks-2.4.1.tgz", 3892 - "integrity": "sha512-1I+RwWyS+kdv3Mv0Vmc+p0dPYH0DTRAo04HLyXReYBL9AeseDWUJyi4THuksBJcu9F0Pih69Ak150VDnqbVnXg==", 3893 - "license": "MIT", 3894 - "engines": { 3895 - "node": ">=16" 3896 - }, 3897 - "peerDependencies": { 3898 - "react": ">=18.0.0", 3899 - "react-dom": ">=18.0.0" 3900 - } 3901 3887 }, 3902 3888 "node_modules/@vue/compiler-core": { 3903 3889 "version": "3.2.45",
-1
package.json
··· 17 17 "@iconify-icons/mingcute": "~1.2.9", 18 18 "@justinribeiro/lite-youtube": "~1.5.0", 19 19 "@szhsin/react-menu": "~4.1.0", 20 - "@uidotdev/usehooks": "~2.4.1", 21 20 "compare-versions": "~6.1.0", 22 21 "dayjs": "~1.11.11", 23 22 "dayjs-twitter": "~0.5.0",
+1 -1
src/components/menu2.jsx
··· 1 1 import { Menu } from '@szhsin/react-menu'; 2 - import { useWindowSize } from '@uidotdev/usehooks'; 3 2 import { useRef } from 'preact/hooks'; 4 3 5 4 import safeBoundingBoxPadding from '../utils/safe-bounding-box-padding'; 5 + import useWindowSize from '../utils/useWindowSize'; 6 6 7 7 // It's like Menu but with sensible defaults, bug fixes and improvements. 8 8 function Menu2(props) {
+28
src/utils/useWindowSize.js
··· 1 + import { useLayoutEffect, useState } from 'preact/hooks'; 2 + 3 + export default function useWindowSize() { 4 + const [size, setSize] = useState({ 5 + width: null, 6 + height: null, 7 + }); 8 + 9 + useLayoutEffect(() => { 10 + const handleResize = () => { 11 + setSize({ 12 + width: window.innerWidth, 13 + height: window.innerHeight, 14 + }); 15 + }; 16 + 17 + handleResize(); 18 + window.addEventListener('resize', handleResize, { 19 + passive: true, 20 + }); 21 + 22 + return () => { 23 + window.removeEventListener('resize', handleResize); 24 + }; 25 + }, []); 26 + 27 + return size; 28 + }