From ab67bb1e8ed0ba91daf61a2f93bb613ed280520f Mon Sep 17 00:00:00 2001 From: Geoffrey Chong Date: Sun, 6 Mar 2022 18:43:21 +1100 Subject: [PATCH] changed: better a11y on loading states --- web/docs/guides/with-react.mdx | 126 ++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 57 deletions(-) diff --git a/web/docs/guides/with-react.mdx b/web/docs/guides/with-react.mdx index 6dbdfa4851c..40e73002da9 100644 --- a/web/docs/guides/with-react.mdx +++ b/web/docs/guides/with-react.mdx @@ -230,23 +230,27 @@ export default function Auth() { return (
-
+

Supabase + React

Sign in via magic link with your email below

-
- - setEmail(e.target.value)} - /> -
- + {loading ? ( + 'Sending magic link...' + ) : ( +
+ + setEmail(e.target.value)} + /> + +
+ )}
) @@ -263,7 +267,7 @@ Let's create a new component for that called `Account.js`. import { useState, useEffect } from 'react' import { supabase } from './supabaseClient' -export default ({ session }) => { +const Account = ({ session }) => { const [loading, setLoading] = useState(true) const [username, setUsername] = useState(null) const [website, setWebsite] = useState(null) @@ -330,39 +334,45 @@ export default ({ session }) => { } return ( - <> -
-
Email: {session.user.email}
-
- - setUsername(e.target.value)} - /> -
-
- - setWebsite(e.target.value)} - /> -
-
- -
-
+
+ {loading ? ( + 'Saving ...' + ) : ( +
+
Email: {session.user.email}
+
+ + setUsername(e.target.value)} + /> +
+
+ + setWebsite(e.target.value)} + /> +
+
+ +
+
+ )} - +
) } + +export default Account ``` ### Launch! @@ -467,25 +477,27 @@ export default ({ url, size, onUpload }) => { } return ( -
+
{avatarUrl - - - - + {uploading ? "Uploading..." : ( + + + + + )}
) }