diff --git a/frontend/package.json b/frontend/package.json index 5a2c297f09..0b2f5bb6ad 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ "dependencies": { "@dicebear/collection": "^9.4.0", "@dicebear/core": "^9.4.0", + "framer-motion": "^12.35.0", "hamburger-menu": "^0.7.1", "hamburger-react": "^2.5.2", "react": "^18.2.0", diff --git a/frontend/src/components/CompletedQuests.jsx b/frontend/src/components/CompletedQuests.jsx index da210d61eb..9bda361cce 100644 --- a/frontend/src/components/CompletedQuests.jsx +++ b/frontend/src/components/CompletedQuests.jsx @@ -1,14 +1,30 @@ import { useQuestStore } from "../stores/useQuestStore" import { QuestCard } from "./cards/QuestCard" +import { useState } from "react" +import { motion, AnimatePresence } from 'framer-motion' export const CompletedQuests = () => { const { quests, completeQuest, deleteQuest } = useQuestStore() - const completed = quests.filter(quest => quest.done === true) + const [ isVisible, setIsVisible ] = useState(false) return ( <>

Completed quests

+ + + + {isVisible && ( + + {completed.map((quest) => ( { handleChecked={completeQuest} onDelete={deleteQuest} /> - ))} - - ) -} \ No newline at end of file + ))} + + )} + + + ) + } \ No newline at end of file diff --git a/frontend/src/components/CreateQuest.jsx b/frontend/src/components/CreateQuest.jsx index a7436d9378..66ef9e5932 100644 --- a/frontend/src/components/CreateQuest.jsx +++ b/frontend/src/components/CreateQuest.jsx @@ -66,7 +66,7 @@ export const CreateQuest = () => { {/* NOTE: category commented out for now. Not used currently */} ) } const Form = styled.form` - margin: 10px; + margin: 20px 0; padding: 16px; border-radius: 12px; border: 2px solid #B594FF; background: #FFF; box-shadow: 2px 4px 4px 0 #DBDBDB; + text-align: center; ` const Label = styled.label` @@ -109,7 +110,6 @@ const Input = styled.input` const Button = styled.button` display: flex; - width: 315px; height: 54px; padding: 8px 16px; justify-content: center; diff --git a/frontend/src/components/QuestLibrary.jsx b/frontend/src/components/QuestLibrary.jsx index 720a8262df..e17f8393c7 100644 --- a/frontend/src/components/QuestLibrary.jsx +++ b/frontend/src/components/QuestLibrary.jsx @@ -1,11 +1,13 @@ import { LibraryQuestCard } from "./cards/LibraryQuestCard" -import { useEffect } from 'react' +import { useState } from 'react' import { useQuestStore } from "../stores/useQuestStore" import styled from 'styled-components' import questLibrary from '../library.json' +import { motion, AnimatePresence } from 'framer-motion' export const QuestLibrary = () => { const { fetchLibraryQuests, libraryQuests, duplicateQuest, createQuest } = useQuestStore() + const [ isVisible, setIsVisible ] = useState(false) const handleAdd = (quest) => { createQuest(quest.message, quest.timeNeeded, quest.category) @@ -13,56 +15,35 @@ export const QuestLibrary = () => { return ( <> -

Library

- {questLibrary.map((quest, index) => ( - handleAdd(quest)} - /> - ))} - - - +

Quest library

+ + + + {isVisible && ( + + + {questLibrary.map((quest, index) => ( + handleAdd(quest)} + /> + ))} + + )} + + ) } - - -const Container = styled.div` - display: flex; - padding: 5px 16px; - justify-content: space-between; - border-radius: 12px; - border: 1px solid var(--accent-color); - background-color: #FFFFFF; - box-shadow: 0 2px 2px 0 #DBDBDB; - margin: 5px 10px; - -` - -const P = styled.p` - font-size: 16px; - font-style: normal; - font-weight: 400; - line-height: normal; - margin: 0; -` - -const TimeP = styled.p` - font-family: Roboto; - font-size: 12px; - font-style: normal; - font-weight: 400; - line-height: normal; - color: var(--accent-color); - margin: 0; -` - -const Div = styled.div` - display: flex; - gap: 5px; -` \ No newline at end of file diff --git a/frontend/src/components/QuestList.jsx b/frontend/src/components/QuestList.jsx index d77b21a043..a16e9c9fb1 100644 --- a/frontend/src/components/QuestList.jsx +++ b/frontend/src/components/QuestList.jsx @@ -1,14 +1,16 @@ // import { apiUrl } from '../../api'; import styled from 'styled-components'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import { QuestCard } from './cards/QuestCard'; import { useQuestStore } from '../stores/useQuestStore'; import { useUserStore } from '../stores/useUserStore'; +import { motion, AnimatePresence } from 'framer-motion' export const QuestList = () => { const { quests, error, isLoading, fetchQuests, deleteQuest, completeQuest } = useQuestStore() const { user } = useUserStore() + const [ isVisible, setIsVisible ] = useState(false) useEffect(() => { fetchQuests() @@ -19,7 +21,21 @@ export const QuestList = () => { return ( <> -

Your quests:

+

My quests

+ + + + {isVisible && ( + + {quests .filter(quest => !quest.done) .map((quest) => ( @@ -33,7 +49,10 @@ export const QuestList = () => { onDelete={deleteQuest} handleChecked={completeQuest} /> - ))} + ))} + + )} + ) };