mirror of
https://github.com/remvze/moodist.git
synced 2025-12-17 00:44:14 +00:00
feat: migrate to motion and fix some animations
This commit is contained in:
parent
81d9d7ca03
commit
b191e6067d
13 changed files with 96 additions and 28 deletions
69
package-lock.json
generated
69
package-lock.json
generated
|
|
@ -25,6 +25,7 @@
|
||||||
"framer-motion": "10.16.4",
|
"framer-motion": "10.16.4",
|
||||||
"howler": "2.2.4",
|
"howler": "2.2.4",
|
||||||
"js-confetti": "0.12.0",
|
"js-confetti": "0.12.0",
|
||||||
|
"motion": "12.23.12",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-hotkeys-hook": "3.2.1",
|
"react-hotkeys-hook": "3.2.1",
|
||||||
|
|
@ -20732,6 +20733,74 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/motion": {
|
||||||
|
"version": "12.23.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion/-/motion-12.23.12.tgz",
|
||||||
|
"integrity": "sha512-8jCD8uW5GD1csOoqh1WhH1A6j5APHVE15nuBkFeRiMzYBdRwyAHmSP/oXSuW0WJPZRXTFdBoG4hY9TFWNhhwng==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"framer-motion": "^12.23.12",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@emotion/is-prop-valid": "*",
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@emotion/is-prop-valid": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-dom": {
|
||||||
|
"version": "12.23.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.23.12.tgz",
|
||||||
|
"integrity": "sha512-RcR4fvMCTESQBD/uKQe49D5RUeDOokkGRmz4ceaJKDBgHYtZtntC/s2vLvY38gqGaytinij/yi3hMcWVcEF5Kw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"motion-utils": "^12.23.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/motion-utils": {
|
||||||
|
"version": "12.23.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.23.6.tgz",
|
||||||
|
"integrity": "sha512-eAWoPgr4eFEOFfg2WjIsMoqJTW6Z8MTUCgn/GZ3VRpClWBdnbjryiA3ZSNLyxCTmCQx4RmYX6jX1iWHbenUPNQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/motion/node_modules/framer-motion": {
|
||||||
|
"version": "12.23.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.23.12.tgz",
|
||||||
|
"integrity": "sha512-6e78rdVtnBvlEVgu6eFEAgG9v3wLnYEboM8I5O5EXvfKC8gxGQB8wXJdhkMy10iVcn05jl6CNw7/HTsTCfwcWg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"motion-dom": "^12.23.12",
|
||||||
|
"motion-utils": "^12.23.6",
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@emotion/is-prop-valid": "*",
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@emotion/is-prop-valid": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/mrmime": {
|
"node_modules/mrmime": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz",
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
"framer-motion": "10.16.4",
|
"framer-motion": "10.16.4",
|
||||||
"howler": "2.2.4",
|
"howler": "2.2.4",
|
||||||
"js-confetti": "0.12.0",
|
"js-confetti": "0.12.0",
|
||||||
|
"motion": "12.23.12",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-hotkeys-hook": "3.2.1",
|
"react-hotkeys-hook": "3.2.1",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { BiUndo, BiTrash } from 'react-icons/bi/index';
|
import { BiUndo, BiTrash } from 'react-icons/bi/index';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'motion/react';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
|
|
||||||
import { Tooltip } from '@/components/tooltip';
|
import { Tooltip } from '@/components/tooltip';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { AnimatePresence } from 'framer-motion';
|
import { AnimatePresence } from 'motion/react';
|
||||||
|
|
||||||
import { Category } from './category';
|
import { Category } from './category';
|
||||||
import { Donate } from './donate';
|
import { Donate } from './donate';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'motion/react';
|
||||||
import { IoClose } from 'react-icons/io5/index';
|
import { IoClose } from 'react-icons/io5/index';
|
||||||
import FocusTrap from 'focus-trap-react';
|
import FocusTrap from 'focus-trap-react';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useState, useEffect, useMemo, useCallback } from 'react';
|
import { useState, useEffect, useMemo, useCallback } from 'react';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'motion/react';
|
||||||
|
|
||||||
import { padNumber } from '@/helpers/number';
|
import { padNumber } from '@/helpers/number';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'motion/react';
|
||||||
|
|
||||||
import { mix, fade, slideY } from '@/lib/motion';
|
import { mix, fade, slideY } from '@/lib/motion';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { BiHeart, BiSolidHeart } from 'react-icons/bi/index';
|
import { BiHeart, BiSolidHeart } from 'react-icons/bi/index';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'motion/react';
|
||||||
|
|
||||||
import { useSoundStore } from '@/stores/sound';
|
import { useSoundStore } from '@/stores/sound';
|
||||||
import { cn } from '@/helpers/styles';
|
import { cn } from '@/helpers/styles';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useState, useMemo, useCallback, useRef, useEffect } from 'react';
|
import { useState, useMemo, useCallback, useRef, useEffect } from 'react';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'motion/react';
|
||||||
|
|
||||||
import { Sound } from './sound';
|
import { Sound } from './sound';
|
||||||
import { useLocalStorage } from '@/hooks/use-local-storage';
|
import { useLocalStorage } from '@/hooks/use-local-storage';
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { useState, useMemo, useCallback } from 'react';
|
||||||
import { IoMenu, IoClose } from 'react-icons/io5/index';
|
import { IoMenu, IoClose } from 'react-icons/io5/index';
|
||||||
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||||
import { useHotkeys } from 'react-hotkeys-hook';
|
import { useHotkeys } from 'react-hotkeys-hook';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'motion/react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ShuffleItem,
|
ShuffleItem,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { BiUpArrowAlt } from 'react-icons/bi/index';
|
import { BiUpArrowAlt } from 'react-icons/bi/index';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion } from 'motion/react';
|
||||||
|
|
||||||
import { mix, fade, slideY } from '@/lib/motion';
|
import { mix, fade, slideY } from '@/lib/motion';
|
||||||
|
|
||||||
|
|
@ -30,22 +30,20 @@ export function ScrollToTop() {
|
||||||
const variants = mix(fade(), slideY(10, 0));
|
const variants = mix(fade(), slideY(10, 0));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatePresence>
|
<motion.button
|
||||||
{isVisible ? (
|
animate={isVisible ? 'show' : 'hidden'}
|
||||||
<motion.button
|
aria-label="Scroll to top"
|
||||||
animate="show"
|
className={styles.button}
|
||||||
aria-label="Scroll to top"
|
exit="hidden"
|
||||||
className={styles.button}
|
initial="hidden"
|
||||||
exit="hidden"
|
variants={variants}
|
||||||
initial="hidden"
|
style={{
|
||||||
variants={variants}
|
pointerEvents: isVisible ? 'auto' : 'none',
|
||||||
onClick={scrollToTop}
|
visibility: isVisible ? 'visible' : 'hidden',
|
||||||
>
|
}}
|
||||||
<BiUpArrowAlt />
|
onClick={scrollToTop}
|
||||||
</motion.button>
|
>
|
||||||
) : (
|
<BiUpArrowAlt />
|
||||||
<div />
|
</motion.button>
|
||||||
)}
|
|
||||||
</AnimatePresence>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'motion/react';
|
||||||
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
||||||
|
|
||||||
import { slideX, slideY, mix, fade } from '@/lib/motion';
|
import { slideX, slideY, mix, fade } from '@/lib/motion';
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {
|
||||||
useRef,
|
useRef,
|
||||||
useContext,
|
useContext,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { AnimatePresence } from 'framer-motion';
|
import { AnimatePresence } from 'motion/react';
|
||||||
|
|
||||||
import { Snackbar } from '@/components/snackbar';
|
import { Snackbar } from '@/components/snackbar';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue