-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add React import, update connector type, refactor Button component st…
…yling, create Input component with label handling. - Added React import for Account.tsx - Updated connector type to 'any' in Account.tsx - Refactored Button component styling in Button.tsx - Created Input component with label handling in Input.tsx
- Loading branch information
1 parent
4e50a18
commit 01c1832
Showing
17 changed files
with
204 additions
and
179 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
22 changes: 7 additions & 15 deletions
22
packages/moon-react/src/components/AuthOptions/AuthOptions.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
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ import { useMoonSDK } from "../../context"; | |
import { AuthModalConfig } from "../../types"; | ||
import Button from "../Button/Button"; | ||
import React from "react"; | ||
import Input from "../Input/Input"; | ||
|
||
interface EmailLoginProps { | ||
config: AuthModalConfig; | ||
|
@@ -42,55 +43,46 @@ const EmailLogin = ({ config }: EmailLoginProps) => { | |
setIsLoggingIn(false); | ||
} | ||
}; | ||
if (isLoggingIn) | ||
return ( | ||
<div className="flex flex-col gap-4 items-center justify-center"> | ||
<div className="animate-spin rounded-full h-32 w-32 border-t-2 border-b-2 border-text-primary"></div> | ||
Logging in... | ||
</div> | ||
); | ||
|
||
return ( | ||
<> | ||
<div className="w-full"> | ||
<label | ||
htmlFor="email" | ||
className="block text-sm font-medium leading-6 text-text-secondary" | ||
> | ||
</label> | ||
<div className="relative mt-1 rounded-md shadow-sm"> | ||
<input | ||
type="text" | ||
name="email" | ||
value={email} | ||
onChange={(e) => setEmail(e.target.value)} | ||
id="email" | ||
className={`block w-full rounded-${authConfig.appearance.input.borderRadius} border-0 py-1.5 pl-2 pr-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6`} | ||
placeholder={ | ||
config?.appearance?.input?.placeholders?.email || | ||
"eg. [email protected]" | ||
} | ||
/> | ||
</div> | ||
</div> | ||
<div className="w-full"> | ||
<label | ||
htmlFor="password" | ||
className="block text-sm font-medium leading-6 text-text-secondary" | ||
> | ||
Password | ||
</label> | ||
<div className="relative mt-1 rounded-md shadow-sm"> | ||
<input | ||
type="password" | ||
name="password" | ||
value={password} | ||
onChange={(e) => setPassword(e.target.value)} | ||
id="password" | ||
className={`block w-full rounded-${authConfig.appearance.input.borderRadius} border-0 py-1.5 pl-2 pr-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6`} | ||
placeholder={ | ||
config?.appearance?.input?.placeholders?.password || "******" | ||
} | ||
/> | ||
</div> | ||
</div> | ||
<Input | ||
label="Email" | ||
id="email" | ||
type="text" | ||
name="email" | ||
value={email} | ||
onChange={(e) => setEmail(e.target.value)} | ||
style={{ | ||
borderRadius: authConfig.appearance.input.borderRadius || "3px", | ||
}} | ||
placeholder={ | ||
config?.appearance?.input?.placeholders?.email || | ||
"eg. [email protected]" | ||
} | ||
/> | ||
<Input | ||
label="Password" | ||
id="password" | ||
type="password" | ||
name="password" | ||
value={password} | ||
onChange={(e) => setPassword(e.target.value)} | ||
placeholder={ | ||
config?.appearance?.input?.placeholders?.password || "******" | ||
} | ||
/> | ||
<Button onClick={handleLoginEmail} color="successColor"> | ||
Login | ||
</Button> | ||
{error && <div className="text-red-500">{error}</div>} | ||
</> | ||
); | ||
}; | ||
|
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,31 @@ | ||
import React from "react"; | ||
import { useMoonSDK } from "../.."; | ||
|
||
type InputProps = { | ||
label: string; | ||
} & React.InputHTMLAttributes<HTMLInputElement>; | ||
|
||
function Input({ label, ...rest }: InputProps) { | ||
const { authConfig } = useMoonSDK(); | ||
return ( | ||
<div className="w-full"> | ||
<label | ||
htmlFor={label} | ||
className="block text-sm font-medium leading-6 text-text-secondary" | ||
> | ||
{label} | ||
</label> | ||
<input | ||
id={label} | ||
name={label} | ||
{...rest} | ||
style={{ | ||
borderRadius: authConfig.appearance.input.borderRadius || "3px", | ||
}} | ||
className={`block w-full border-0 py-1.5 pl-2 pr-2 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6`} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default Input; |
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 "./Input"; |
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
1 change: 1 addition & 0 deletions
1
packages/moon-react/src/components/Oauth2Button/Oauth2Button.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import React from "react"; | ||
import getEnvVariables from "../../utils/getEnvVariables"; | ||
|
||
function Oauth2Button() { | ||
|
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
Oops, something went wrong.