From 5f84ac7360782905c560292c34156fb947e97635 Mon Sep 17 00:00:00 2001 From: VictorGinelli Date: Tue, 25 Jan 2022 13:00:44 -0800 Subject: [PATCH] Use frmaer motion to animate new screens --- packages/web/components/UI/ProgressBar.js | 2 +- .../components/mint/ChallengeMintScreen.js | 7 +++ .../components/mint/ChallengeTypeScreen.js | 32 ++++++----- packages/web/pages/mint.js | 53 ++++++++++++------- 4 files changed, 57 insertions(+), 37 deletions(-) create mode 100644 packages/web/components/mint/ChallengeMintScreen.js diff --git a/packages/web/components/UI/ProgressBar.js b/packages/web/components/UI/ProgressBar.js index 8a030e0..ac212bf 100644 --- a/packages/web/components/UI/ProgressBar.js +++ b/packages/web/components/UI/ProgressBar.js @@ -9,7 +9,7 @@ export const ProgressBar = ({ progressLabels, index }) => {
{progressLabels.map((item, itemIndex) => (
{index === itemIndex && ( diff --git a/packages/web/components/mint/ChallengeMintScreen.js b/packages/web/components/mint/ChallengeMintScreen.js new file mode 100644 index 0000000..bc1968b --- /dev/null +++ b/packages/web/components/mint/ChallengeMintScreen.js @@ -0,0 +1,7 @@ +export const ChallengeMintScreen = () => { + return ( +
+

Challenge Mint Screen

+
+ ); +}; diff --git a/packages/web/components/mint/ChallengeTypeScreen.js b/packages/web/components/mint/ChallengeTypeScreen.js index fb046f1..4a89cce 100644 --- a/packages/web/components/mint/ChallengeTypeScreen.js +++ b/packages/web/components/mint/ChallengeTypeScreen.js @@ -14,9 +14,9 @@ const placeholderChallengeType = { totalQuantity: 0, }; -const ChallengeTypeScreen = (props) => { +export const ChallengeTypeScreen = (props) => { return ( -
+
{ { name, description, prtclePrice, maxQuantity, totalQuantity }, actions ) => { - const price = utils.parseEther(prtclePrice).toString(); - const quantity = utils.parseEther(maxQuantity).toString(); - const total = utils.parseEther(totalQuantity).toString(); + // const price = utils.parseEther(prtclePrice).toString(); + // const quantity = utils.parseEther(maxQuantity).toString(); + // const total = utils.parseEther(totalQuantity).toString(); - await props.addChallengeTypes([ - { - name, - description, - prtclePrice: price, - maxQuantity: quantity, - totalQuantity: total, - }, - ]); + // await props.addChallengeTypes([ + // { + // name, + // description, + // prtclePrice: price, + // maxQuantity: quantity, + // totalQuantity: total, + // }, + // ]); props.setIndex(1); actions.setSubmitting(false); }} > - + { ); }; -export default ChallengeTypeScreen; - const TextArea = styled.textarea``; const FormFrame = styled(Form)` diff --git a/packages/web/pages/mint.js b/packages/web/pages/mint.js index 61b93e5..4089ad6 100644 --- a/packages/web/pages/mint.js +++ b/packages/web/pages/mint.js @@ -8,12 +8,11 @@ import { useChallengeContract } from '/hooks/useChallengeContract'; import diamondABI from '../../contracts/diamondABI/diamond.json'; import dynamic from 'next/dynamic'; -import { Formik, Form, Field } from 'formik'; -import Player from 'react-player'; -import ChallengeTypeScreen from '/components/mint/ChallengeTypeScreen'; +import { ChallengeTypeScreen } from '/components/mint/ChallengeTypeScreen'; +import { ChallengeMintScreen } from '/components/mint/ChallengeMintScreen'; import { ProgressBar } from '/components/UI'; -import { utils } from 'ethers'; import { calculateGasMargin, GAS_MARGIN } from '../utils'; +import { AnimatePresence, motion } from 'framer-motion'; const SelfIdForm = dynamic(() => import('/components/SelfIdForm'), { ssr: false, @@ -86,13 +85,38 @@ const Mint = (props) => { }); }; + const currentPage = (i) => { + switch (i) { + case 0: + return ( + + ); + case 1: + return ; + default: + return null; + } + }; + return ( -
+
- + + + {currentPage(index)} + + + {/* { {/* */}
)} -
+
); }; export default Mint; -const Main = styled.main` - display: flex; - justify-content: space-around; - align-items: center; - flex-direction: column; - min-height: 100vh; - position: relative; -`; - const FormFrame = styled.form` display: flex; flex-direction: column;