-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from design-sparx/ft/onboard
chore(ui): changed onboarding flow to landing -> signin -> dashboard,…
- Loading branch information
Showing
5 changed files
with
60 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,29 @@ import { | |
} from '@mantine/core'; | ||
import Link from 'next/link'; | ||
import { PATH_AUTH, PATH_DASHBOARD } from '@/routes'; | ||
import { Metadata } from 'next'; | ||
import { Surface } from '@/components'; | ||
import classes from './page.module.css'; | ||
import { useForm } from '@mantine/form'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
const LINK_PROPS: TextProps = { | ||
className: classes.link, | ||
}; | ||
|
||
function Page() { | ||
const LINK_PROPS: TextProps = { | ||
className: classes.link, | ||
}; | ||
const { push } = useRouter(); | ||
const form = useForm({ | ||
initialValues: { email: '[email protected]', password: 'Demo@123' }, | ||
|
||
// functions will be used to validate values at corresponding key | ||
validate: { | ||
email: (value) => (/^\S+@\S+$/.test(value) ? null : 'Invalid email'), | ||
password: (value) => | ||
value && value?.length < 6 | ||
? 'Password must include at least 6 characters' | ||
: null, | ||
}, | ||
}); | ||
|
||
return ( | ||
<> | ||
|
@@ -36,38 +51,44 @@ function Page() { | |
<Text ta="center">Sign in to your account to continue</Text> | ||
|
||
<Surface component={Paper} className={classes.card}> | ||
<TextInput | ||
label="Email" | ||
placeholder="[email protected]" | ||
required | ||
classNames={{ label: classes.label }} | ||
/> | ||
<PasswordInput | ||
label="Password" | ||
placeholder="Your password" | ||
required | ||
mt="md" | ||
classNames={{ label: classes.label }} | ||
/> | ||
<Group justify="space-between" mt="lg"> | ||
<Checkbox label="Remember me" classNames={{ label: classes.label }} /> | ||
<Text | ||
component={Link} | ||
href={PATH_AUTH.passwordReset} | ||
size="sm" | ||
{...LINK_PROPS} | ||
> | ||
Forgot password? | ||
</Text> | ||
</Group> | ||
<Button | ||
fullWidth | ||
mt="xl" | ||
component={Link} | ||
href={PATH_DASHBOARD.default} | ||
<form | ||
onSubmit={form.onSubmit(() => { | ||
push(PATH_DASHBOARD.default); | ||
})} | ||
> | ||
Sign in | ||
</Button> | ||
<TextInput | ||
label="Email" | ||
placeholder="[email protected]" | ||
required | ||
classNames={{ label: classes.label }} | ||
{...form.getInputProps('email')} | ||
/> | ||
<PasswordInput | ||
label="Password" | ||
placeholder="Your password" | ||
required | ||
mt="md" | ||
classNames={{ label: classes.label }} | ||
{...form.getInputProps('password')} | ||
/> | ||
<Group justify="space-between" mt="lg"> | ||
<Checkbox | ||
label="Remember me" | ||
classNames={{ label: classes.label }} | ||
/> | ||
<Text | ||
component={Link} | ||
href={PATH_AUTH.passwordReset} | ||
size="sm" | ||
{...LINK_PROPS} | ||
> | ||
Forgot password? | ||
</Text> | ||
</Group> | ||
<Button fullWidth mt="xl" type="submit"> | ||
Sign in | ||
</Button> | ||
</form> | ||
<Center mt="md"> | ||
<Text | ||
fz="sm" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ | |
} | ||
|
||
@mixin dark { | ||
background-color: var(--mantine-color-dark-6); | ||
background-color: var(--mantine-color-dark-9); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters