From 5d7b83c8cad1e45e7336bc61a1e7b1b192cd3bcb Mon Sep 17 00:00:00 2001 From: Junichi Sugiura Date: Fri, 31 May 2024 15:11:20 +0200 Subject: [PATCH] Adjust login/signup layout (#329) * Adjust login/signup layout * Fix clear button in input field --- .../keychain/src/components/Auth/Login.tsx | 10 +++-- .../keychain/src/components/Auth/Signup.tsx | 11 ++---- .../src/components/Container/Header/index.tsx | 6 +-- .../src/components/Container/index.tsx | 7 ++-- .../keychain/src/components/PortalBanner.tsx | 39 +++++++++---------- .../src/components/PortalFooter/index.tsx | 13 +++---- packages/keychain/src/pages/_app.tsx | 2 +- packages/ui/src/components/Field.tsx | 4 +- packages/ui/src/theme/components/Button.ts | 1 - 9 files changed, 45 insertions(+), 48 deletions(-) diff --git a/packages/keychain/src/components/Auth/Login.tsx b/packages/keychain/src/components/Auth/Login.tsx index 8e0c75956..ccd9b4f40 100644 --- a/packages/keychain/src/components/Auth/Login.tsx +++ b/packages/keychain/src/components/Auth/Login.tsx @@ -1,4 +1,4 @@ -import { Field } from "@cartridge/ui"; +import { Field, FingerprintIcon } from "@cartridge/ui"; import { VStack, Button } from "@chakra-ui/react"; import { Container } from "../Container"; import { Form as FormikForm, Field as FormikField, Formik } from "formik"; @@ -85,7 +85,7 @@ export function Login({ ); return ( - + - + - {({ field, meta }) => ( + {({ field, meta, form }) => ( form.setFieldValue(field.name, "")} /> )} @@ -134,6 +135,7 @@ export function Login({ type="submit" colorScheme="colorful" isLoading={isLoading} + leftIcon={} > Log in diff --git a/packages/keychain/src/components/Auth/Signup.tsx b/packages/keychain/src/components/Auth/Signup.tsx index 1f4ef885c..800d8031d 100644 --- a/packages/keychain/src/components/Auth/Signup.tsx +++ b/packages/keychain/src/components/Auth/Signup.tsx @@ -21,7 +21,6 @@ import { client } from "utils/graphql"; import { PopupCenter } from "utils/url"; import { FormValues, SignupProps } from "./types"; import { isIframe, validateUsernameFor } from "./utils"; -import { useClearField } from "./hooks"; import { RegistrationLink } from "./RegistrationLink"; import { doSignup } from "hooks/account"; import { useControllerTheme } from "hooks/theme"; @@ -68,7 +67,7 @@ export function Signup({ return ( <> - + { onLoginProp(values.username); }, [values.username, onLoginProp]); @@ -188,20 +185,20 @@ function Form({ description="Create your Cartridge Controller" /> - + - {({ field, meta }) => ( + {({ field, meta, form }) => ( form.setFieldValue(field.name, "")} isLoading={isValidating} /> )} diff --git a/packages/keychain/src/components/Container/Header/index.tsx b/packages/keychain/src/components/Container/Header/index.tsx index 910bbe029..a3d8a8b2f 100644 --- a/packages/keychain/src/components/Container/Header/index.tsx +++ b/packages/keychain/src/components/Container/Header/index.tsx @@ -61,14 +61,14 @@ export function Header({ right={0} > @@ -69,7 +72,6 @@ function Wrapper({ children }: React.PropsWithChildren) { - + - - {!!Icon && ( - - - - )} + + {!!Icon && ( + + + + )} - {!!icon && ( - - {icon} - - )} + {!!icon && ( + + {icon} + + )} - - {title} + + {title} + + + {description && ( + + {description} - {description && ( - - {description} - - )} - + )} ); } diff --git a/packages/keychain/src/components/PortalFooter/index.tsx b/packages/keychain/src/components/PortalFooter/index.tsx index ade3fdf3b..d06a11d6e 100644 --- a/packages/keychain/src/components/PortalFooter/index.tsx +++ b/packages/keychain/src/components/PortalFooter/index.tsx @@ -42,13 +42,12 @@ export function PortalFooter({ const height = useMemo( () => isOpen - ? `${ - window.document.body.scrollHeight - - BANNER_HEIGHT - - FOOTER_HEIGHT + - ICON_SIZE / 2 - - ICON_OFFSET - }px` + ? `${window.innerHeight - + BANNER_HEIGHT - + FOOTER_HEIGHT + + ICON_SIZE / 2 - + ICON_OFFSET + }px` : "auto", [isOpen], ); diff --git a/packages/keychain/src/pages/_app.tsx b/packages/keychain/src/pages/_app.tsx index b9b2b4865..2fd0c684b 100644 --- a/packages/keychain/src/pages/_app.tsx +++ b/packages/keychain/src/pages/_app.tsx @@ -39,7 +39,7 @@ export default function Keychain({ Component, pageProps }: AppProps) { } body { - background: var(--chakra-colors-translucent-lg); + background: var(--chakra-colors-solid-bg); } `} diff --git a/packages/ui/src/components/Field.tsx b/packages/ui/src/components/Field.tsx index 947e1621e..61d998cf1 100644 --- a/packages/ui/src/components/Field.tsx +++ b/packages/ui/src/components/Field.tsx @@ -67,7 +67,7 @@ export function Field({ cursor={isActive ? "pointer" : "default"} opacity={isActive ? 100 : 0} // workaround for onBlur handler triggeres before onClear > - + ) )} @@ -75,7 +75,7 @@ export function Field({ {error && touched && ( - + {error} diff --git a/packages/ui/src/theme/components/Button.ts b/packages/ui/src/theme/components/Button.ts index 18ff0b402..7d0ced39a 100644 --- a/packages/ui/src/theme/components/Button.ts +++ b/packages/ui/src/theme/components/Button.ts @@ -18,7 +18,6 @@ export const Button: ComponentStyleConfig = defineStyleConfig({ }, lineHeight: "none", textTransform: "uppercase", - letterSpacing: "widest", _disabled: { pointerEvents: "none", },