diff options
author | Sebastian <sebasjm@gmail.com> | 2023-09-25 08:40:18 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-09-25 14:50:44 -0300 |
commit | ae49194d4271f1108ec9b8318ea3b7977314cb85 (patch) | |
tree | 9a386163e762e64e4ba7d1c1a37f53ad1f0b3eca /packages/demobank-ui/src/pages/RegistrationPage.tsx | |
parent | 15af6c619de70336bcdfbabbd32b9d93aabefc5b (diff) | |
download | wallet-core-ae49194d4271f1108ec9b8318ea3b7977314cb85.tar.gz wallet-core-ae49194d4271f1108ec9b8318ea3b7977314cb85.tar.bz2 wallet-core-ae49194d4271f1108ec9b8318ea3b7977314cb85.zip |
more ui
Diffstat (limited to 'packages/demobank-ui/src/pages/RegistrationPage.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/RegistrationPage.tsx | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/packages/demobank-ui/src/pages/RegistrationPage.tsx b/packages/demobank-ui/src/pages/RegistrationPage.tsx index 8221457bf..5325f43ab 100644 --- a/packages/demobank-ui/src/pages/RegistrationPage.tsx +++ b/packages/demobank-ui/src/pages/RegistrationPage.tsx @@ -33,8 +33,10 @@ const logger = new Logger("RegistrationPage"); export function RegistrationPage({ onComplete, + onCancel }: { onComplete: () => void; + onCancel: () => void; }): VNode { const { i18n } = useTranslationContext(); if (!bankUiSettings.allowRegistrations) { @@ -42,7 +44,7 @@ export function RegistrationPage({ <p>{i18n.str`Currently, the bank is not accepting new registrations!`}</p> ); } - return <RegistrationForm onComplete={onComplete} />; + return <RegistrationForm onComplete={onComplete} onCancel={onCancel} />; } export const USERNAME_REGEX = /^[a-z][a-zA-Z0-9-]*$/; @@ -50,7 +52,7 @@ export const USERNAME_REGEX = /^[a-z][a-zA-Z0-9-]*$/; /** * Collect and submit registration data. */ -function RegistrationForm({ onComplete }: { onComplete: () => void }): VNode { +function RegistrationForm({ onComplete, onCancel }: { onComplete: () => void, onCancel: () => void }): VNode { const backend = useBackendContext(); const [username, setUsername] = useState<string | undefined>(); const [name, setName] = useState<string | undefined>(); @@ -169,8 +171,37 @@ function RegistrationForm({ onComplete }: { onComplete: () => void }): VNode { autoCorrect="off" > <div> + <label for="name" class="block text-sm font-medium leading-6 text-gray-900"> + <i18n.Translate>Name</i18n.Translate> + <b style={{ color: "red" }}> *</b> + </label> + <div class="mt-2"> + <input + autoFocus + type="text" + name="name" + id="name" + class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + value={name ?? ""} + enterkeyhint="next" + placeholder="your name" + autocomplete="name" + required + onInput={(e): void => { + setName(e.currentTarget.value); + }} + /> + <ShowInputErrorLabel + message={errors?.name} + isDirty={name !== undefined} + /> + </div> + </div> + + <div> <label for="username" class="block text-sm font-medium leading-6 text-gray-900"> <i18n.Translate>Username</i18n.Translate> + <b style={{ color: "red" }}> *</b> </label> <div class="mt-2"> <input @@ -197,7 +228,10 @@ function RegistrationForm({ onComplete }: { onComplete: () => void }): VNode { <div> <div class="flex items-center justify-between"> - <label for="password" class="block text-sm font-medium leading-6 text-gray-900">Password</label> + <label for="password" class="block text-sm font-medium leading-6 text-gray-900"> + Password + <b style={{ color: "red" }}> *</b> + </label> </div> <div class="mt-2"> <input @@ -223,7 +257,10 @@ function RegistrationForm({ onComplete }: { onComplete: () => void }): VNode { <div> <div class="flex items-center justify-between"> - <label for="register-repeat" class="block text-sm font-medium leading-6 text-gray-900">Repeat assword</label> + <label for="register-repeat" class="block text-sm font-medium leading-6 text-gray-900"> + Repeat assword + <b style={{ color: "red" }}> *</b> + </label> </div> <div class="mt-2"> <input @@ -247,9 +284,18 @@ function RegistrationForm({ onComplete }: { onComplete: () => void }): VNode { </div> </div> - <div> + <div class="flex w-full justify-between"> + <button type="submit" + class="ring-1 ring-gray-600 rounded-md bg-white disabled:bg-gray-300 px-3 py-1.5 text-sm font-semibold leading-6 text-black shadow-sm hover:bg-white-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2" + onClick={(e) => { + e.preventDefault() + onCancel() + }} + > + <i18n.Translate>Cancel</i18n.Translate> + </button> <button type="submit" - class="flex w-full justify-center rounded-md bg-indigo-600 disabled:bg-gray-300 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" + class=" rounded-md bg-indigo-600 disabled:bg-gray-300 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" disabled={!!errors} onClick={(e) => { e.preventDefault() |