diff --git a/src/interface/pages/Store.tsx b/src/interface/pages/Store.tsx index e54466a1..e551aedc 100644 --- a/src/interface/pages/Store.tsx +++ b/src/interface/pages/Store.tsx @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'; import { Swiper, SwiperSlide } from 'swiper/react'; import Header from '../components/store/header'; import { Autoplay } from 'swiper/modules'; -import { motion } from 'framer-motion'; +import { motion, AnimatePresence } from 'framer-motion'; import 'swiper/css'; import 'swiper/css/pagination'; @@ -12,6 +12,32 @@ import SpinnerIcon from '../components/LoadingSpinner'; import localforage from 'localforage'; import { StoreDownloadTheme } from '../../seqta/ui/themes/downloadTheme'; +const textVariants = { + hidden: { opacity: 0, y: 60 }, + visible: { opacity: 1, y: 0, transition: { + type: 'spring', + bounce: 0, + stiffness: 80, + damping: 12 + } }, +}; + +const containerVariants = { + hidden: { + y: '100vh', + }, + visible: { + y: 0, + transition: { + staggerChildren: 0.05, + type: 'spring', + bounce: 0, + stiffness: 400, + damping: 50 + }, + }, +}; + export type Theme = { name: string; description: string; @@ -42,6 +68,7 @@ const Store = () => { const [coverThemes, setCoverThemes] = useState([]); const [installingThemes, setInstallingThemes] = useState([]); const [currentThemes, setCurrentThemes] = useState([]); + const [displayTheme, setDisplayTheme] = useState(null); const [loading, setLoading] = useState(true); const fetchThemes = async () => { @@ -140,7 +167,7 @@ const Store = () => { }} > { coverThemes.map((theme, index) => ( - + setDisplayTheme(theme)} key={index}> Theme Preview { + + {displayTheme && ( + setDisplayTheme(null)} + > + e.stopPropagation()} + className="w-full max-w-xl h-[95%] p-8 bg-white rounded-t-2xl dark:bg-zinc-800 overflow-scroll" + exit={{ y: "100vh" }} + transition={{ type: 'spring', stiffness: 300, damping: 30 }} + variants={containerVariants} + initial="hidden" + animate="visible" + > + + setDisplayTheme(null)} + variants={textVariants} + > + × + + + {displayTheme.name} + + + + {displayTheme.description} + + downloadTheme(displayTheme.id)} + className="flex px-4 py-2 mt-4 ml-auto rounded-full dark:text-white bg-zinc-300 dark:bg-zinc-700 dark:hover:bg-zinc-600/50 hover:bg-zinc-200 focus:outline-none focus:ring-2 focus:ring-zinc-800 focus:ring-offset-2" + variants={textVariants} + > + { installingThemes.includes(displayTheme.id) ? + <> + + Installing... + : + <> Install + } + + + + + + More Themes + +
+ {gridThemes.filter(theme => theme.id !== displayTheme.id).map((theme, index) => ( + { setDisplayTheme(null); setDisplayTheme(theme); }} className='w-full cursor-pointer' variants={textVariants}> +
+
+
+ {theme.name} +
+

+ {theme.description} +

+
+
+ Theme Preview +
+ + ))} +
+
+ + + )} + + {/* pagination */}