From 8b91e09a65c2480dd234c3f673bf7e5d019155a7 Mon Sep 17 00:00:00 2001 From: Spencer Spenst Date: Thu, 23 May 2024 15:01:32 -0700 Subject: [PATCH] username select --- components/forms/forgotPasswordForm.tsx | 2 +- components/forms/loginForm.tsx | 2 +- components/forms/signupFormWizard.tsx | 67 ++++++++++++++----------- components/page/loadingSpinner.tsx | 30 +++++------ pages/[subdomain]/play/index.tsx | 2 +- 5 files changed, 53 insertions(+), 50 deletions(-) diff --git a/components/forms/forgotPasswordForm.tsx b/components/forms/forgotPasswordForm.tsx index 54fdf13aa..ce45ef390 100644 --- a/components/forms/forgotPasswordForm.tsx +++ b/components/forms/forgotPasswordForm.tsx @@ -55,7 +55,7 @@ export default function ForgotPasswordForm() { {errorMessage} } -
+
} -
+
{'New to Thinky.gg? '} diff --git a/components/forms/signupFormWizard.tsx b/components/forms/signupFormWizard.tsx index 658961c98..3de537e6f 100644 --- a/components/forms/signupFormWizard.tsx +++ b/components/forms/signupFormWizard.tsx @@ -95,7 +95,7 @@ export default function SignupFormWizard() { const resObj = await res.json(); setIsExistsLoading(false); - setUsernameExists(!resObj.exists); + setUsernameExists(resObj.exists); }; // debounce the checkUsername function @@ -129,33 +129,38 @@ export default function SignupFormWizard() { return ( -
+ -
+
- +
+ + {username.length >= 3 && +
+ {isExistsLoading ? : + isValidUsername && !usernameExists ? +
+ Username is available +
+ : +
+ {!isValidUsername ? 'Username is not valid' : 'Username is not available'} +
+ } +
+ } +
handleUsernameChange(e)} className='w-full' id='username' type='text' placeholder='Username' />
- {username.length >= 3 && -
- {isExistsLoading ? : <> - - {isValidUsername && usernameExists ? '✅' : '❌'} - - - {!isValidUsername ? 'Username is not valid' : usernameExists ? 'Username is available' : 'Username is not available'} - - - } -
- }

@@ -186,22 +191,24 @@ export default function SignupFormWizard() {

- - Play as guest - -
- - {'Already have an account? '} - +
- Log in + Play as guest +
+ + {'Already have an account? '} + + + Log in + +
diff --git a/components/page/loadingSpinner.tsx b/components/page/loadingSpinner.tsx index 1e735c436..af8e5b186 100644 --- a/components/page/loadingSpinner.tsx +++ b/components/page/loadingSpinner.tsx @@ -1,29 +1,25 @@ import React from 'react'; interface LoadingSpinnerProps { - size?: 'small' | 'medium' | 'large'; + size?: number; } -export default function LoadingSpinner({ size }: LoadingSpinnerProps) { - if (size === 'small') { - return +export default function LoadingSpinner({ size = 32 }: LoadingSpinnerProps) { + return ( + + stroke='currentColor' strokeWidth='5' strokeLinecap='round' strokeLinejoin='round' style={{ + color: 'var(--bg-color)', + }} + /> + stroke='currentColor' strokeWidth='5' strokeLinecap='round' strokeLinejoin='round' + /> - ; - } - - return ( -
- -
); } diff --git a/pages/[subdomain]/play/index.tsx b/pages/[subdomain]/play/index.tsx index 1752d497a..5eb79567f 100644 --- a/pages/[subdomain]/play/index.tsx +++ b/pages/[subdomain]/play/index.tsx @@ -58,7 +58,7 @@ export default function PlayPage({ reqUser }: PlayPageProps) { <> - : + : }