From bfe22a61a58766d0575cc7919dc6fdc7c55018ab Mon Sep 17 00:00:00 2001 From: Md Asif Date: Sun, 22 Dec 2024 01:38:09 +0530 Subject: [PATCH] Add motion animations to Button and CabinetMaintenance components; update form validation and styling --- package-lock.json | 72 ++++++++++++++++++++ package.json | 1 + src/App.jsx | 31 +++++++-- src/components/Button.jsx | 7 +- src/components/FormBox.jsx | 23 +++++-- src/components/MenuBar.jsx | 53 +++++++++++---- src/pages/CabinetCreation.jsx | 111 +++++++++++++++++++++++-------- src/pages/CabinetMaintenance.jsx | 73 +++++++++++++------- 8 files changed, 291 insertions(+), 80 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1510e09..6b9fe30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "i18next-browser-languagedetector": "^8.0.0", "i18next-http-backend": "^2.6.1", "lucide-react": "^0.446.0", + "motion": "^11.15.0", "prop-types": "^15.8.1", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -2857,6 +2858,33 @@ "url": "https://github.com/sponsors/rawify" } }, + "node_modules/framer-motion": { + "version": "11.15.0", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.15.0.tgz", + "integrity": "sha512-MLk8IvZntxOMg7lDBLw2qgTHHv664bYoYmnFTmE0Gm/FW67aOJk0WM3ctMcG+Xhcv+vh5uyyXwxvxhSeJzSe+w==", + "license": "MIT", + "dependencies": { + "motion-dom": "^11.14.3", + "motion-utils": "^11.14.3", + "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/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -3928,6 +3956,44 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/motion": { + "version": "11.15.0", + "resolved": "https://registry.npmjs.org/motion/-/motion-11.15.0.tgz", + "integrity": "sha512-iZ7dwADQJWGsqsSkBhNHdI2LyYWU+hA1Nhy357wCLZq1yHxGImgt3l7Yv0HT/WOskcYDq9nxdedyl4zUv7UFFw==", + "license": "MIT", + "dependencies": { + "framer-motion": "^11.15.0", + "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": "11.14.3", + "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-11.14.3.tgz", + "integrity": "sha512-lW+D2wBy5vxLJi6aCP0xyxTxlTfiu+b+zcpVbGVFUxotwThqhdpPRSmX8xztAgtZMPMeU0WGVn/k1w4I+TbPqA==", + "license": "MIT" + }, + "node_modules/motion-utils": { + "version": "11.14.3", + "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-11.14.3.tgz", + "integrity": "sha512-Xg+8xnqIJTpr0L/cidfTTBFkvRw26ZtGGuIhA94J9PQ2p4mEa06Xx7QVYZH0BP+EpMSaDlu+q0I0mmvwADPsaQ==", + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -5327,6 +5393,12 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index e527be6..292e45e 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "i18next-browser-languagedetector": "^8.0.0", "i18next-http-backend": "^2.6.1", "lucide-react": "^0.446.0", + "motion": "^11.15.0", "prop-types": "^15.8.1", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/src/App.jsx b/src/App.jsx index b0eca92..0642603 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,19 +1,38 @@ -import { Outlet } from "react-router-dom"; +import { useOutlet } from "react-router"; +import { useState } from "react"; import Header from "./components/Header"; import Footer from "./components/Footer"; -import { ToastProvider } from "./components/Toast"; +import { AnimatePresence } from "motion/react"; +import { motion } from "motion/react"; +import { useLocation } from "react-router"; + +const AnimatedOutlet = () => { + const o = useOutlet(); + const [outlet] = useState(o); + + return
{outlet}
; +}; function App() { + const location = useLocation(); return ( -
-
- +
+ + + + +
-
); } diff --git a/src/components/Button.jsx b/src/components/Button.jsx index eaae491..08eea22 100644 --- a/src/components/Button.jsx +++ b/src/components/Button.jsx @@ -1,13 +1,16 @@ import PropTypes from 'prop-types'; +import { motion } from 'motion/react'; function Button({text, onClick}) { return ( - + ) } diff --git a/src/components/FormBox.jsx b/src/components/FormBox.jsx index 6a18b84..ec5c987 100644 --- a/src/components/FormBox.jsx +++ b/src/components/FormBox.jsx @@ -1,10 +1,23 @@ -import { PropTypes } from 'prop-types'; -import clsx from 'clsx'; +import { PropTypes } from "prop-types"; +import clsx from "clsx"; function FormBox({ title, children, alt = false }) { return ( -
-