diff --git a/src/components/App.css b/src/components/App.css index 358d661..d838cc6 100644 --- a/src/components/App.css +++ b/src/components/App.css @@ -9,7 +9,7 @@ } html { - margin-top: 80px; + margin-top: 120px; display: flex; flex-direction: column; justify-content: center; diff --git a/src/components/pages/Practice/CustomPractice/customPractice-style.js b/src/components/pages/Practice/CustomPractice/customPractice-style.js index fe1a7de..8b5dbf6 100644 --- a/src/components/pages/Practice/CustomPractice/customPractice-style.js +++ b/src/components/pages/Practice/CustomPractice/customPractice-style.js @@ -15,7 +15,6 @@ const TimerDivP = styled.p` const CustomPracticeDiv = styled.div` min-height: 40vh; width: 100%; - padding-left: 1rem; `; const ButtonsDiv = styled.div` diff --git a/src/components/pages/Practice/CustomPractice/customPractice.js b/src/components/pages/Practice/CustomPractice/customPractice.js index 3de8463..bfdef1c 100644 --- a/src/components/pages/Practice/CustomPractice/customPractice.js +++ b/src/components/pages/Practice/CustomPractice/customPractice.js @@ -117,35 +117,6 @@ export default function CustomPractice({ - {/* - How long would you like to practice? - */} - {/* - - - - setTimer(value)} - /> - - - - */} Which decks would you like to practice? diff --git a/src/components/pages/Practice/FinishPractice/finishedPractice.js b/src/components/pages/Practice/FinishPractice/finishedPractice.js index ed6c483..4b46d98 100644 --- a/src/components/pages/Practice/FinishPractice/finishedPractice.js +++ b/src/components/pages/Practice/FinishPractice/finishedPractice.js @@ -4,6 +4,7 @@ import Confetti from 'react-confetti'; import styled from 'styled-components'; import Button from '@material-ui/core/Button'; import PropTypes from 'prop-types'; +import useYourDecks from '../../../../hooks/useYourDecks'; const FinishPracticeWrapper = styled.div` height: 100vh; @@ -18,8 +19,14 @@ const TextDiv = styled.div` margin: 10rem; `; -export default function FinishPractice({ setPracticeStage }) { +export default function FinishPractice({ + setPracticeStage, + setSelectedDecks, + setDecks, +}) { const { width, height } = useWindowSize(); + + useYourDecks({ setDecks, setSelectedDecks }); return ( @@ -27,7 +34,9 @@ export default function FinishPractice({ setPracticeStage }) { @@ -37,4 +46,6 @@ export default function FinishPractice({ setPracticeStage }) { FinishPractice.propTypes = { setPracticeStage: PropTypes.func.isRequired, + setSelectedDecks: PropTypes.func.isRequired, + setDecks: PropTypes.func.isRequired, }; diff --git a/src/components/pages/Practice/practice.js b/src/components/pages/Practice/practice.js index 6238230..96f83cb 100644 --- a/src/components/pages/Practice/practice.js +++ b/src/components/pages/Practice/practice.js @@ -37,6 +37,12 @@ export default function Practice() { } if (practiceStage === 'finishedPractice') { - return ; + return ( + + ); } } diff --git a/src/components/pages/YourDecks/children/CreateDeckForm.js b/src/components/pages/YourDecks/children/CreateDeckForm.js index 7d14f5c..5b373b6 100644 --- a/src/components/pages/YourDecks/children/CreateDeckForm.js +++ b/src/components/pages/YourDecks/children/CreateDeckForm.js @@ -2,22 +2,14 @@ import React from 'react'; import PropTypes from 'prop-types'; import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; +import CardMedia from '@material-ui/core/CardMedia'; import TextField from '@material-ui/core/TextField'; import Button from '@material-ui/core/Button'; -import { makeStyles } from '@material-ui/core/styles'; +import { Typography } from '@material-ui/core'; import fetchData from '../../../../utils/fetchData/fetchData'; +import { useStyles, FormButtonsDiv, NewDeckForm } from './Deck-style'; export default function CreateDeckForm({ setDeckCreate }) { - const useStyles = makeStyles((theme) => ({ - root: { - '& > *': { - margin: theme.spacing(1), - width: '25ch', - }, - }, - card: {}, // can style card also - button: {}, // need to style buttons - })); const classes = useStyles(); const cancelHandler = (event) => { @@ -47,19 +39,20 @@ export default function CreateDeckForm({ setDeckCreate }) { }); // how to test error handling and also need to handle errors better here. }; + const cardClasses = `${classes.root} ${classes.newDeckForm}`; + return ( - + + - {/* do we need label for the form in material UI? */} -
+ + Create a new deck - - - + + + + +
+ + // + // + // {/* do we need label for the form in material UI? */} + //
+ // + // + // + // + //
+ //
); } diff --git a/src/components/pages/YourDecks/children/Deck-style.js b/src/components/pages/YourDecks/children/Deck-style.js index 66a8606..01324b4 100644 --- a/src/components/pages/YourDecks/children/Deck-style.js +++ b/src/components/pages/YourDecks/children/Deck-style.js @@ -5,16 +5,37 @@ const ViewDecksDiv = styled.div` height: 100%; width: 100%; max-width: 320px; - max-height: 400px; + display: flex; flex-wrap: wrap; cursor: pointer; overflow-x: auto; + position: relative; +`; + +const FormButtonsDiv = styled.div` + display: flex; + width: 100%; + justify-content: space-between; +`; + +const NewDeckForm = styled.form` + width: 100%; `; const useStyles = makeStyles({ root: { - width: 150, + 'width': 140, + 'margin': '0.25rem', + '&:hover': { + background: 'rgb(252,193,6)', + }, + }, + newDeckForm: { + position: 'fixed', + width: '320px', + height: '300px', + top: '200px', }, bullet: { display: 'inline-block', @@ -27,15 +48,10 @@ const useStyles = makeStyles({ pos: { marginBottom: 12, }, - card: { - width: '120px', - height: '75px', - margin: '1rem', - }, button: { 'padding': '20px', 'font-size': '60rem', }, }); -export { ViewDecksDiv, useStyles }; +export { ViewDecksDiv, useStyles, FormButtonsDiv, NewDeckForm }; diff --git a/src/components/pages/YourDecks/children/clickableDeck.js b/src/components/pages/YourDecks/children/clickableDeck.js index 08d77cd..52412d6 100644 --- a/src/components/pages/YourDecks/children/clickableDeck.js +++ b/src/components/pages/YourDecks/children/clickableDeck.js @@ -3,21 +3,29 @@ import PropTypes from 'prop-types'; import Card from '@material-ui/core/Card'; import Typography from '@material-ui/core/Typography'; import CardContent from '@material-ui/core/CardContent'; +import CardMedia from '@material-ui/core/CardMedia'; import { useHistory } from 'react-router-dom'; import { useStyles } from './Deck-style'; export default function ClickableDeck({ deck, setViewingDeck }) { const classes = useStyles(); const history = useHistory(); + + const cardClasses = `${classes.root} ${classes.card}`; + return ( - { - setViewingDeck(deck.deck_id); - history.push('/cards-in-deck'); - }} - > + + { + setViewingDeck(deck.deck_id); + history.push('/cards-in-deck'); + }} + /> {deck.deck_name} diff --git a/src/components/pages/YourDecks/yourDecks.js b/src/components/pages/YourDecks/yourDecks.js index 1a8cb45..b9d8bf6 100644 --- a/src/components/pages/YourDecks/yourDecks.js +++ b/src/components/pages/YourDecks/yourDecks.js @@ -28,7 +28,7 @@ export default function MyDecks({ setViewingDeck }) { {deckCreate && }