From 73307b4df78bafecca5b5410a9c0b6dd91992370 Mon Sep 17 00:00:00 2001 From: Nguyen Thanh Quynh Linh Date: Mon, 17 Jun 2024 22:25:08 +0700 Subject: [PATCH] Update ModernTimeline --- package-lock.json | 188 ++--------- package.json | 1 + src/app/(page)/albums/page.tsx | 8 +- src/app/(page)/layout.tsx | 27 +- src/app/(page)/page.tsx | 27 +- src/components/Home/HomeAlbums/HomeAlbums.tsx | 6 +- src/components/Home/home.module.scss | 34 +- src/components/Image/ImageBanner.tsx | 77 +++-- src/components/Loader/HeartLoader.module.scss | 297 ++++++++++++++++++ src/components/Loader/HeartLoader.tsx | 18 ++ src/components/Loader/LoadingPage.module.scss | 171 ++++++++++ src/components/Loader/LoadingPage.tsx | 40 +++ src/components/Modal/ModernTimeline.tsx | 66 ++++ .../ModernTimeline/ModernTimeline.module.scss | 12 +- .../ModernTimeline/ModernTimeline.tsx | 246 ++++----------- .../ModernTimeline/ModernTimelineEvent.tsx | 90 ++++++ .../ModernTimeline/TextComponent.tsx | 24 -- src/libs/data.ts | 1 - 18 files changed, 880 insertions(+), 453 deletions(-) create mode 100644 src/components/Loader/HeartLoader.module.scss create mode 100644 src/components/Loader/HeartLoader.tsx create mode 100644 src/components/Loader/LoadingPage.module.scss create mode 100644 src/components/Loader/LoadingPage.tsx create mode 100644 src/components/Modal/ModernTimeline.tsx create mode 100644 src/components/ModernTimeline/ModernTimelineEvent.tsx delete mode 100644 src/components/ModernTimeline/TextComponent.tsx diff --git a/package-lock.json b/package-lock.json index d9e5fb1..948c3bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "axios": "^1.7.2", "buffer": "^6.0.3", "classnames": "^2.5.1", - "cloudinary": "^2.2.0", + "framer-motion": "^11.2.10", "intersection-observer": "^0.12.2", "keen-slider": "^6.8.6", "moment-timezone": "^0.5.45", @@ -30,7 +30,6 @@ "qs": "^6.12.1", "react": "^18", "react-archer": "^4.4.0", - "react-chrono": "^2.6.1", "react-dom": "^18", "react-query": "^3.39.3", "react-redux": "^8.1.3", @@ -1682,11 +1681,6 @@ "@types/react": "*" } }, - "node_modules/@types/stylis": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/@types/stylis/-/stylis-4.2.5.tgz", - "integrity": "sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw==" - }, "node_modules/@types/use-sync-external-store": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz", @@ -2532,14 +2526,6 @@ "node": ">= 6" } }, - "node_modules/camelize": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.1.tgz", - "integrity": "sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/caniuse-lite": { "version": "1.0.30001632", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001632.tgz", @@ -2628,18 +2614,6 @@ "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, - "node_modules/cloudinary": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cloudinary/-/cloudinary-2.2.0.tgz", - "integrity": "sha512-akbLTZcNegGSkl07Frnt9fyiK9KZ2zPS+a+j7uLrjNYxVhDpDdIBz9G6snPCYqgk+WLVMRPfXTObalLr5L6g0Q==", - "dependencies": { - "lodash": "^4.17.21", - "q": "^1.5.1" - }, - "engines": { - "node": ">=9" - } - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -2760,24 +2734,6 @@ "node": ">= 8" } }, - "node_modules/css-color-keywords": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", - "integrity": "sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==", - "engines": { - "node": ">=4" - } - }, - "node_modules/css-to-react-native": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.2.0.tgz", - "integrity": "sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==", - "dependencies": { - "camelize": "^1.0.0", - "css-color-keywords": "^1.0.0", - "postcss-value-parser": "^4.0.2" - } - }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -2790,11 +2746,6 @@ "node": ">=4" } }, - "node_modules/cssfilter": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz", - "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw==" - }, "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", @@ -2857,11 +2808,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/dayjs": { - "version": "1.11.11", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", - "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==" - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3776,11 +3722,6 @@ "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, - "node_modules/focus-visible": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/focus-visible/-/focus-visible-5.2.0.tgz", - "integrity": "sha512-Rwix9pBtC1Nuy5wysTmKy+UjbDJpIfg8eHjw0rjZ1mX4GNLz1Bmd16uDpI3Gk1i70Fgcs8Csg2lPm8HULFg9DQ==" - }, "node_modules/follow-redirects": { "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", @@ -3838,6 +3779,30 @@ "node": ">= 6" } }, + "node_modules/framer-motion": { + "version": "11.2.10", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.2.10.tgz", + "integrity": "sha512-/gr3PLZUVFCc86a9MqCUboVrALscrdluzTb3yew+2/qKBU8CX6nzs918/SRBRCqaPbx0TZP10CB6yFgK2C5cYQ==", + "dependencies": { + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "peerDependenciesMeta": { + "@emotion/is-prop-valid": { + "optional": true + }, + "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", @@ -4901,11 +4866,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -5592,6 +5552,7 @@ "version": "8.4.38", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", + "dev": true, "funding": [ { "type": "opencollective", @@ -5733,7 +5694,8 @@ "node_modules/postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true }, "node_modules/preact": { "version": "10.22.0", @@ -5792,15 +5754,6 @@ "node": ">=6" } }, - "node_modules/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, "node_modules/qs": { "version": "6.12.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz", @@ -5869,23 +5822,6 @@ "react": "^16.9.0 || ^17 || ^18" } }, - "node_modules/react-chrono": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/react-chrono/-/react-chrono-2.6.1.tgz", - "integrity": "sha512-9KcREgRaUd39rjNjFqP9OiDUWWpu8pBoPcfZGPQoXlpmBjrN10BMmb2StHNcyWrpIFvpG4Ok4Dh1pRv1cuTuWg==", - "dependencies": { - "classnames": "^2.5.1", - "dayjs": "^1.11.10", - "focus-visible": "^5.2.0", - "styled-components": "^6.1.8", - "use-debounce": "^10.0.0", - "xss": "^1.0.15" - }, - "peerDependencies": { - "react": "^18.1.0", - "react-dom": "^18.1.0" - } - }, "node_modules/react-dom": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", @@ -6349,11 +6285,6 @@ "node": ">= 0.4" } }, - "node_modules/shallowequal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", - "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" - }, "node_modules/sharp": { "version": "0.33.4", "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.4.tgz", @@ -6694,38 +6625,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/styled-components": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.11.tgz", - "integrity": "sha512-Ui0jXPzbp1phYij90h12ksljKGqF8ncGx+pjrNPsSPhbUUjWT2tD1FwGo2LF6USCnbrsIhNngDfodhxbegfEOA==", - "dependencies": { - "@emotion/is-prop-valid": "1.2.2", - "@emotion/unitless": "0.8.1", - "@types/stylis": "4.2.5", - "css-to-react-native": "3.2.0", - "csstype": "3.1.3", - "postcss": "8.4.38", - "shallowequal": "1.1.0", - "stylis": "4.3.2", - "tslib": "2.6.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/styled-components" - }, - "peerDependencies": { - "react": ">= 16.8.0", - "react-dom": ">= 16.8.0" - } - }, - "node_modules/styled-components/node_modules/stylis": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz", - "integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==" - }, "node_modules/styled-jsx": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", @@ -7204,17 +7103,6 @@ } } }, - "node_modules/use-debounce": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/use-debounce/-/use-debounce-10.0.1.tgz", - "integrity": "sha512-0uUXjOfm44e6z4LZ/woZvkM8FwV1wiuoB6xnrrOmeAEjRDDzTLQNRFtYHvqUsJdrz1X37j0rVGIVp144GLHGKg==", - "engines": { - "node": ">= 16.0.0" - }, - "peerDependencies": { - "react": ">=16.8.0" - } - }, "node_modules/use-sync-external-store": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz", @@ -7530,26 +7418,6 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, - "node_modules/xss": { - "version": "1.0.15", - "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.15.tgz", - "integrity": "sha512-FVdlVVC67WOIPvfOwhoMETV72f6GbW7aOabBC3WxN/oUdoEMDyLz4OgRv5/gck2ZeNqEQu+Tb0kloovXOfpYVg==", - "dependencies": { - "commander": "^2.20.3", - "cssfilter": "0.0.10" - }, - "bin": { - "xss": "bin/xss" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/xss/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", diff --git a/package.json b/package.json index 2dea4db..fc49099 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "axios": "^1.7.2", "buffer": "^6.0.3", "classnames": "^2.5.1", + "framer-motion": "^11.2.10", "intersection-observer": "^0.12.2", "keen-slider": "^6.8.6", "moment-timezone": "^0.5.45", diff --git a/src/app/(page)/albums/page.tsx b/src/app/(page)/albums/page.tsx index 3fef35c..c2a9542 100644 --- a/src/app/(page)/albums/page.tsx +++ b/src/app/(page)/albums/page.tsx @@ -1,6 +1,7 @@ 'use client'; import styles from '@/components/Albums/Albums.module.scss'; import SlideMultipleItems from '@/components/Albums/Slider/Slider'; +import HeartLoader from '@/components/Loader/HeartLoader'; import Timeline from '@/components/Timeline/Timeline'; import { get } from '@/libs/axiosConfig'; import { fetchDataMoments } from '@/libs/fetchData'; @@ -24,8 +25,13 @@ export default function Albums(params: AlbumsProps) { dispatch(findAllListImageByYears({ years: 2023 })); dispatch(findAllListImageByYears({ years: 2024 })); }, [dispatch]); + return isLoading ? ( -
Lỗi đang tải...
+
+
+ +
+
) : (
diff --git a/src/app/(page)/layout.tsx b/src/app/(page)/layout.tsx index e5ba3b7..48b2632 100644 --- a/src/app/(page)/layout.tsx +++ b/src/app/(page)/layout.tsx @@ -3,16 +3,17 @@ import BackToTopButton from '@/components/BackToTop/BackToTop'; import Footer from '@/components/common/Footer/Footer'; import Header from '@/components/common/Header/page'; import HeartCreator from '@/components/Home/HeartCreator'; +import LoadingPage from '@/components/Loader/LoadingPage'; import { useAppDispatch, useAppSelector } from '@/libs/hook'; import { initHearts } from '@/redux/features/heartSlice'; import { usePathname } from 'next/navigation'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; export default function ComponentConnectLayout({ children }: { children: React.ReactNode }) { const pathname = usePathname(); const selector = useAppSelector((state) => state.heart); const dispatch = useAppDispatch(); - + const [isOpenPage, setOpenPage] = useState(false); useEffect(() => { if (typeof window !== 'undefined') { const isRemoveHearts = localStorage.getItem('isRemoved'); @@ -29,12 +30,20 @@ export default function ComponentConnectLayout({ children }: { children: React.R return pathname === '/albums' ? ( children ) : ( - <> -
- {children} - {selector.status ? : ''} - -