Skip to content

Commit

Permalink
fix: view layout alignment (#220)
Browse files Browse the repository at this point in the history
* added Container component

* Add changeset file to bump the package version

---------

Co-authored-by: Andrew Smith <[email protected]>
  • Loading branch information
Hallidayo and silentworks authored Sep 17, 2023
1 parent a80400e commit 5607ea4
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-crews-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@supabase/auth-ui-react': patch
---

Fix view layout alignment
18 changes: 10 additions & 8 deletions packages/react/src/components/Auth/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,16 @@ function Auth({
)
case VIEWS.FORGOTTEN_PASSWORD:
return (
<ForgottenPassword
appearance={appearance}
supabaseClient={supabaseClient}
setAuthView={setAuthView}
redirectTo={redirectTo}
showLinks={showLinks}
i18n={i18n}
/>
<Container>
<ForgottenPassword
appearance={appearance}
supabaseClient={supabaseClient}
setAuthView={setAuthView}
redirectTo={redirectTo}
showLinks={showLinks}
i18n={i18n}
/>
</Container>
)

case VIEWS.MAGIC_LINK:
Expand Down
84 changes: 43 additions & 41 deletions packages/react/src/components/Auth/interfaces/ForgottenPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,49 +48,51 @@ function ForgottenPassword({

return (
<form id="auth-forgot-password" onSubmit={handlePasswordReset}>
<Container gap="large" direction="vertical" appearance={appearance}>
<div>
<Label htmlFor="email" appearance={appearance}>
{labels?.email_label}
</Label>
<Input
id="email"
name="email"
type="email"
autoFocus
placeholder={labels?.email_input_placeholder}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setEmail(e.target.value)
}
appearance={appearance}
/>
</div>
<Button
type="submit"
color="primary"
loading={loading}
appearance={appearance}
>
{loading ? labels?.loading_button_label : labels?.button_label}
</Button>
{showLinks && (
<Anchor
href="#auth-sign-in"
onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {
e.preventDefault()
setAuthView(VIEWS.SIGN_IN)
}}
<Container direction="vertical" gap="large" appearance={appearance}>
<Container gap="large" direction="vertical" appearance={appearance}>
<div>
<Label htmlFor="email" appearance={appearance}>
{labels?.email_label}
</Label>
<Input
id="email"
name="email"
type="email"
autoFocus
placeholder={labels?.email_input_placeholder}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
setEmail(e.target.value)
}
appearance={appearance}
/>
</div>
<Button
type="submit"
color="primary"
loading={loading}
appearance={appearance}
>
{i18n?.sign_in?.link_text}
</Anchor>
)}
{message && <Message appearance={appearance}>{message}</Message>}
{error && (
<Message color="danger" appearance={appearance}>
{error}
</Message>
)}
{loading ? labels?.loading_button_label : labels?.button_label}
</Button>
{showLinks && (
<Anchor
href="#auth-sign-in"
onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {
e.preventDefault()
setAuthView(VIEWS.SIGN_IN)
}}
appearance={appearance}
>
{i18n?.sign_in?.link_text}
</Anchor>
)}
{message && <Message appearance={appearance}>{message}</Message>}
{error && (
<Message color="danger" appearance={appearance}>
{error}
</Message>
)}
</Container>
</Container>
</form>
)
Expand Down

0 comments on commit 5607ea4

Please sign in to comment.