From 57b19b93fed629cacb123cb663f057ab47502d9e Mon Sep 17 00:00:00 2001 From: Juan Di Toro Date: Tue, 19 Sep 2023 15:59:16 +0200 Subject: [PATCH] fix: weird animations bugs + use the lightweight version of framer-motion --- src/components/SwitchableComponent.tsx | 4 +-- .../lume/LumeIdentity/LumeIdentity.tsx | 18 +++++----- .../lume/LumeIdentity/components.tsx | 34 +++++++++++-------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/components/SwitchableComponent.tsx b/src/components/SwitchableComponent.tsx index 3a80cd6..3dd0c89 100644 --- a/src/components/SwitchableComponent.tsx +++ b/src/components/SwitchableComponent.tsx @@ -52,7 +52,7 @@ export const SwitchableComponent = ({ children, index }: React.PropsWithChildren animate="show" exit="exit" variants={variants} - className="h-full min-h-12 w-96" + className="h-full w-full" > {children} @@ -78,4 +78,4 @@ export function makeSwitchable(Component: React.FC, index: stri render(props: T) { return }, index: index || Symbol(Component.name).toString() }; -}; \ No newline at end of file +}; diff --git a/src/components/lume/LumeIdentity/LumeIdentity.tsx b/src/components/lume/LumeIdentity/LumeIdentity.tsx index b5687b1..eb91e10 100644 --- a/src/components/lume/LumeIdentity/LumeIdentity.tsx +++ b/src/components/lume/LumeIdentity/LumeIdentity.tsx @@ -1,4 +1,3 @@ -// src/components/sign-in-with-lume.tsx import React from 'react'; import LumeLogoBg from '@/assets/lume-logo-bg.svg'; @@ -6,6 +5,7 @@ import { Button } from '@/components/ui/button'; import { SwitchableComponent, SwitchableComponentProvider, useSwitchableComponent } from '@/components/SwitchableComponent'; import ComponentList from "./components"; import { LumeIdentityContext, Session } from './LumeIdentityContext'; +import { LazyMotion, domAnimation } from 'framer-motion'; type Props = {} @@ -22,11 +22,11 @@ const LumeIdentity: React.FC = ({ }) => { const coloredOrLine = isSubmitButtonInView ? 'text-primary' : 'text-border' - return
+ return
-
+

{isSubmitButtonInView || isLoginWithAccountKey ? 'Sign in with Lume' : null} @@ -36,16 +36,18 @@ const LumeIdentity: React.FC = ({ }) => {

- + + + {!isFinalStep ? <> -
- +
+
- : null} @@ -62,4 +64,4 @@ export default () => { -}; \ No newline at end of file +}; diff --git a/src/components/lume/LumeIdentity/components.tsx b/src/components/lume/LumeIdentity/components.tsx index ac96f01..582d081 100644 --- a/src/components/lume/LumeIdentity/components.tsx +++ b/src/components/lume/LumeIdentity/components.tsx @@ -2,7 +2,7 @@ import { makeSwitchable, useSwitchableComponent } from "@/components/SwitchableC import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { CheckIcon, ClipboardCopyIcon, ExclamationTriangleIcon } from "@radix-ui/react-icons"; -import { AnimatePresence, motion } from "framer-motion"; +import { AnimatePresence, m } from "framer-motion"; import React from "react"; import { useLumeIndentity } from "./LumeIdentityContext"; @@ -19,7 +19,7 @@ const SubmitButtonComponent = ({ }) => { const SeedPhraseInputComponent = ({ }) => { const { signIn } = useLumeIndentity(); return ( - { + { e.preventDefault(); const target = e.target as typeof e.target & { elements: { @@ -30,7 +30,7 @@ const SeedPhraseInputComponent = ({ }) => { signIn(seedPhrase) }}> - { - - + + ); }; const SetupAccountKeyComponent = () => { const { setVisibleComponent } = useSwitchableComponent(); + const [width, setWidth] = React.useState(0); + + console.log({width}) return ( - setTimeout(() => setWidth(t?.getBoundingClientRect().width!), 0)} > - + ) }; @@ -86,7 +90,7 @@ const SeedPhraseGenerationComponent = ({ phraseLength = 12 }) => { return (
- {step === 1 ? { // setOpacity(1); // }, 2000); // }} - > : null} + > : null}
{phrases.map((phrase, index) => ( @@ -105,7 +109,7 @@ const SeedPhraseGenerationComponent = ({ phraseLength = 12 }) => {
))} - {step === 1 ? { > Make sure to write this down for safe keeping. - : null} + : null} ) : null} - {step === 1 ? { - : null} + : null}
)