From df9a3f8089e94217168046e72207a18b5c734884 Mon Sep 17 00:00:00 2001 From: 1ilit Date: Thu, 18 Jan 2024 09:21:30 +0200 Subject: [PATCH] Add framer motion --- package-lock.json | 39 +++++++++++++++++++++++++++++++++++++++ package.json | 1 + src/animations/Reveal.jsx | 30 ++++++++++++++++++++++++++++++ src/pages/LandingPage.jsx | 30 +++++++++++++++++++----------- 4 files changed, 89 insertions(+), 11 deletions(-) create mode 100644 src/animations/Reveal.jsx diff --git a/package-lock.json b/package-lock.json index ec9886b..0449a40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "dexie": "^3.2.4", "dexie-react-hooks": "^1.1.7", "file-saver": "^2.0.5", + "framer-motion": "^10.18.0", "html-to-image": "^1.11.11", "jsonschema": "^1.4.1", "jspdf": "^2.5.1", @@ -563,6 +564,21 @@ "react-dom": ">=16.0.0" } }, + "node_modules/@emotion/is-prop-valid": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==", + "optional": true, + "dependencies": { + "@emotion/memoize": "0.7.4" + } + }, + "node_modules/@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", + "optional": true + }, "node_modules/@esbuild/android-arm": { "version": "0.19.9", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.9.tgz", @@ -3103,6 +3119,29 @@ "url": "https://github.com/sponsors/rawify" } }, + "node_modules/framer-motion": { + "version": "10.18.0", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-10.18.0.tgz", + "integrity": "sha512-oGlDh1Q1XqYPksuTD/usb0I70hq95OUzmL9+6Zd+Hs4XV0oaISBa/UUMSjYiq6m8EUF32132mOJ8xVZS+I0S6w==", + "dependencies": { + "tslib": "^2.4.0" + }, + "optionalDependencies": { + "@emotion/is-prop-valid": "^0.8.2" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", diff --git a/package.json b/package.json index 4c3508e..92bc695 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "dexie": "^3.2.4", "dexie-react-hooks": "^1.1.7", "file-saver": "^2.0.5", + "framer-motion": "^10.18.0", "html-to-image": "^1.11.11", "jsonschema": "^1.4.1", "jspdf": "^2.5.1", diff --git a/src/animations/Reveal.jsx b/src/animations/Reveal.jsx new file mode 100644 index 0000000..5ef2a40 --- /dev/null +++ b/src/animations/Reveal.jsx @@ -0,0 +1,30 @@ +import { useRef, useEffect } from "react"; +import { motion, useInView, useAnimation } from "framer-motion"; + +export default function Reveal({ children }) { + const ref = useRef(null); + const isInView = useInView(ref, { once: true }); + const mainControls = useAnimation(); + + useEffect(() => { + if (isInView) { + mainControls.start("visible"); + } + }, [isInView, mainControls]); + + return ( +
+ + {children} + +
+ ); +} \ No newline at end of file diff --git a/src/pages/LandingPage.jsx b/src/pages/LandingPage.jsx index 0586f73..fa53b03 100644 --- a/src/pages/LandingPage.jsx +++ b/src/pages/LandingPage.jsx @@ -4,6 +4,8 @@ import { IconCrossStroked } from "@douyinfe/semi-icons"; import SimpleCanvas from "../components/SimpleCanvas" import Navbar from "../components/Navbar"; import { diagram } from "../data/heroDiagram" +import Reveal from "../animations/Reveal"; + export default function LandingPage() { const [showSurvey, setShowSurvey] = useState(true); @@ -34,26 +36,32 @@ export default function LandingPage() {
-
-

- Draw, Copy, and Paste -

-
-
- Free, simple, and intuitive database design tool and SQL generator. -
+ +
+

+ Draw, Copy, and Paste +

+
+
+ Free, simple, and intuitive database design tool and SQL generator. +
+
- - + Try it for yourself
-
hi
+
+ more stuff +
); }