From d52236e3ce81b74874ba4bd1eb7042d33b60a3c8 Mon Sep 17 00:00:00 2001 From: Juan Di Toro Date: Tue, 19 Sep 2023 19:19:56 +0200 Subject: [PATCH] fix: animations where weird --- src/components/SwitchableComponent.tsx | 10 +++++++--- .../lume/LumeIdentity/LumeIdentity.tsx | 8 ++++---- src/components/lume/LumeIdentity/components.tsx | 16 ++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/SwitchableComponent.tsx b/src/components/SwitchableComponent.tsx index 3dd0c89..cefb041 100644 --- a/src/components/SwitchableComponent.tsx +++ b/src/components/SwitchableComponent.tsx @@ -1,4 +1,4 @@ -import { Variant, AnimatePresence, motion } from "framer-motion"; +import { Variant, AnimatePresence, m } from "framer-motion"; import React from "react"; const SwitchableComponentContext = React.createContext(undefined); @@ -33,6 +33,7 @@ const variants: Record = { hidden: { y: 50, opacity: 0, position: 'absolute' }, show: { y: 0, + x: 0, opacity: 1, position: 'relative', transition: { @@ -44,18 +45,21 @@ const variants: Record = { }; export const SwitchableComponent = ({ children, index }: React.PropsWithChildren<{ index: string }>) => { + const [width, setWidth] = React.useState() return ( - setWidth(e.currentTarget.getBoundingClientRect().width!)} > {children} - + ); }; diff --git a/src/components/lume/LumeIdentity/LumeIdentity.tsx b/src/components/lume/LumeIdentity/LumeIdentity.tsx index eb91e10..af4c315 100644 --- a/src/components/lume/LumeIdentity/LumeIdentity.tsx +++ b/src/components/lume/LumeIdentity/LumeIdentity.tsx @@ -28,18 +28,18 @@ const LumeIdentity: React.FC = ({ }) => {
-

+

{isSubmitButtonInView || isLoginWithAccountKey ? 'Sign in with Lume' : null} {isCreatingAccount && !isShowingSeedPhrase ? 'Set up your account key' : null} {isShowingSeedPhrase ? "Here's your account key" : null}

- - + + + - {!isFinalStep ? <>
diff --git a/src/components/lume/LumeIdentity/components.tsx b/src/components/lume/LumeIdentity/components.tsx index ec75b60..5a342c0 100644 --- a/src/components/lume/LumeIdentity/components.tsx +++ b/src/components/lume/LumeIdentity/components.tsx @@ -47,15 +47,16 @@ const SeedPhraseInputComponent = ({ }) => { const SetupAccountKeyComponent = () => { const { setVisibleComponent } = useSwitchableComponent(); - const [width, setWidth] = React.useState(0); + const [width, setWidth] = React.useState(); return ( setTimeout(() => setWidth(t?.getBoundingClientRect().width!), 0)} >
{phrases.map((phrase, index) => ( -
- {phrase} +
+ {phrase} {index + 1}
))}