-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84ce500
commit 2071f2c
Showing
12 changed files
with
191 additions
and
7 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
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
37 changes: 37 additions & 0 deletions
37
.../commonwealth/client/scripts/views/modals/AuthModal/common/ModalBase/SMSForm/SMSForm.scss
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,37 @@ | ||
@import '../../../../../../../styles/shared'; | ||
|
||
.SMSForm { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 12px; | ||
width: 100%; | ||
padding: 0 4px; | ||
|
||
.LoadingSpinner { | ||
margin: auto; | ||
} | ||
|
||
.action-btns { | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
justify-content: space-between; | ||
|
||
.btn-border { | ||
margin: 0 !important; | ||
|
||
@include extraSmall { | ||
width: 100% !important; | ||
|
||
button { | ||
width: 100% !important; | ||
} | ||
} | ||
|
||
&:focus-within { | ||
border-width: 1px !important; | ||
padding: 0px !important; | ||
} | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...s/commonwealth/client/scripts/views/modals/AuthModal/common/ModalBase/SMSForm/SMSForm.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,55 @@ | ||
import React from 'react'; | ||
import CWCircleMultiplySpinner from 'views/components/component_kit/new_designs/CWCircleMultiplySpinner'; | ||
import { CWButton } from '../../../../../components/component_kit/new_designs/CWButton'; | ||
import { CWForm } from '../../../../../components/component_kit/new_designs/CWForm'; | ||
import { CWTextInput } from '../../../../../components/component_kit/new_designs/CWTextInput'; | ||
import './SMSForm.scss'; | ||
import { SMSValidationSchema } from './validation'; | ||
|
||
type SMSFormProps = { | ||
onCancel: () => void; | ||
onSubmit: (values: { SMS: string }) => void; | ||
isLoading?: boolean; | ||
}; | ||
|
||
const SMSForm = ({ onSubmit, onCancel, isLoading }: SMSFormProps) => { | ||
return ( | ||
<CWForm | ||
className="SMSForm" | ||
validationSchema={SMSValidationSchema} | ||
onSubmit={!isLoading ? onSubmit : () => {}} | ||
> | ||
{isLoading ? ( | ||
<CWCircleMultiplySpinner /> | ||
) : ( | ||
<> | ||
<CWTextInput | ||
fullWidth | ||
hookToForm | ||
name="SMS" | ||
label="Phone number" | ||
placeholder="Phone number" | ||
/> | ||
<div className="action-btns"> | ||
<CWButton | ||
type="button" | ||
onClick={onCancel} | ||
buttonType="tertiary" | ||
label="Back to sign in options" | ||
disabled={isLoading} | ||
/> | ||
<CWButton | ||
type="submit" | ||
buttonWidth="wide" | ||
buttonType="primary" | ||
label="Sign in with Magic" | ||
disabled={isLoading} | ||
/> | ||
</div> | ||
</> | ||
)} | ||
</CWForm> | ||
); | ||
}; | ||
|
||
export { SMSForm }; |
1 change: 1 addition & 0 deletions
1
...ages/commonwealth/client/scripts/views/modals/AuthModal/common/ModalBase/SMSForm/index.ts
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 { SMSForm } from './SMSForm'; |
7 changes: 7 additions & 0 deletions
7
...commonwealth/client/scripts/views/modals/AuthModal/common/ModalBase/SMSForm/validation.ts
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,7 @@ | ||
import { z } from 'zod'; | ||
|
||
const SMSValidationSchema = z.object({ | ||
SMS: z.string(), | ||
}); | ||
|
||
export { SMSValidationSchema }; |
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