Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Melhorando experiência do usuário nos formulários #1691

Merged
merged 9 commits into from
May 13, 2024
15 changes: 9 additions & 6 deletions pages/cadastro/index.public.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Heading,
Link,
PasswordInput,
Text,
TextInput,
} from '@/TabNewsUI';
import { createErrorMessage, suggestEmail } from 'pages/interface';
Expand Down Expand Up @@ -129,6 +128,10 @@ function SignUpForm() {
contrast
sx={{ px: 2, '&:focus-within': { backgroundColor: 'canvas.default' } }}
/>
{errorObject?.key !== 'username' && (
<FormControl.Caption>Assim que os outros verão você na plataforma.</FormControl.Caption>
)}

{errorObject?.key === 'username' && (
<FormControl.Validation variant="error">{errorObject.message}</FormControl.Validation>
)}
Expand Down Expand Up @@ -188,13 +191,13 @@ function SignUpForm() {
setErrorObject={setErrorObject}
/>

<Box sx={{ display: 'flex', alignItems: 'center', gap: 3 }}>
<Checkbox checked={isTermsAccepted} onClick={() => setIsTermsAccepted(!isTermsAccepted)} />
<Text>
<FormControl>
<Checkbox checked={isTermsAccepted} onChange={() => setIsTermsAccepted(!isTermsAccepted)} />
<FormControl.Label>
Li e estou de acordo com os
<Link href="/termos-de-uso"> Termos de Uso.</Link>
</Text>
</Box>
</FormControl.Label>
</FormControl>

<FormControl>
<FormControl.Label visuallyHidden>Criar cadastro</FormControl.Label>
Expand Down
9 changes: 9 additions & 0 deletions pages/perfil/index.public.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function EditProfileForm() {
const [errorObject, setErrorObject] = useState(undefined);
const [emailDisabled, setEmailDisabled] = useState(false);
const [description, setDescription] = useState(user?.description || '');
const [showUsernameCaption, setShowUsernameCaption] = useState(false);

useEffect(() => {
if (router && !user && !userIsLoading) {
Expand Down Expand Up @@ -197,7 +198,15 @@ function EditProfileForm() {
aria-label="Seu nome de usuário"
contrast
sx={{ px: 2, '&:focus-within': { backgroundColor: 'canvas.default' } }}
onFocus={() => setShowUsernameCaption(true)}
onBlur={() => setShowUsernameCaption(false)}
/>
{showUsernameCaption && (
<FormControl.Caption>
Alterar o nome de usuário irá quebrar todas as URLs das suas publicações e comentários.
</FormControl.Caption>
)}

{errorObject?.key === 'username' && (
<FormControl.Validation variant="error">{errorObject.message}</FormControl.Validation>
)}
Expand Down