-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
b88999f
commit 3d8fbaa
Showing
13 changed files
with
144 additions
and
44 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { IconError } from 'icons' | ||
|
||
import { Hint } from './Hint' | ||
|
||
const meta: Meta<typeof Hint> = { | ||
title: 'Components/Hint [beta]', | ||
component: Hint | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof Hint> | ||
|
||
export const Default: Story = { | ||
args: { | ||
icon: IconError, | ||
children: | ||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio' | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { IconComponent } from 'components/icon' | ||
import { Paper, PaperProps } from 'components/layout/Paper' | ||
import { Text } from 'components/text' | ||
|
||
type HintProps = { | ||
icon: IconComponent | ||
} & PaperProps | ||
|
||
/* | ||
* A way of informing the user of important details in line in a prominent way. | ||
*/ | ||
export const Hint = (props: HintProps) => { | ||
const { icon: Icon, children, ...other } = props | ||
return ( | ||
<Paper | ||
role='alert' | ||
ph='l' | ||
pv='m' | ||
backgroundColor='surface2' | ||
alignItems='center' | ||
gap='l' | ||
shadow='flat' | ||
border='strong' | ||
{...other} | ||
> | ||
<Icon size='l' color='default' /> | ||
<Text variant='body' color='default'> | ||
{children} | ||
</Text> | ||
</Paper> | ||
) | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Hint' |
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
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
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
3 changes: 1 addition & 2 deletions
3
packages/web/src/pages/sign-up-page/components/CoverPhotoBanner.tsx
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
10 changes: 10 additions & 0 deletions
10
packages/web/src/pages/sign-up-page/components/EmailTakenHint.tsx
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Hint, IconError } from '@audius/harmony' | ||
import { ErrorMessage } from 'formik' | ||
|
||
export const EmailTakenHint = () => { | ||
return ( | ||
<ErrorMessage name='email'> | ||
{(errorMessage) => <Hint icon={IconError}>{errorMessage}</Hint>} | ||
</ErrorMessage> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import { signUpFetch } from '@audius/common' | ||
import { z } from 'zod' | ||
|
||
import { audiusQueryContext } from 'app/AudiusQueryProvider' | ||
import { EMAIL_REGEX } from 'utils/email' | ||
|
||
const messages = { | ||
invalidEmail: 'Please enter a valid email.' | ||
invalidEmail: 'Please enter a valid email.', | ||
emailInUse: 'Email Already Taken' | ||
} | ||
|
||
export const emailSchema = z.object({ | ||
email: z | ||
.string({ required_error: messages.invalidEmail }) | ||
.regex(EMAIL_REGEX, { message: messages.invalidEmail }) | ||
.refine( | ||
async (email) => { | ||
return !(await signUpFetch.isEmailInUse({ email }, audiusQueryContext)) | ||
}, | ||
{ message: messages.emailInUse } | ||
) | ||
}) |
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