-
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.
Merge branch 'functionality-authentication' into development
- Loading branch information
Showing
35 changed files
with
701 additions
and
92 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,11 +8,12 @@ import { formatDate } from "../utils/authUtils"; | |
export const users = [ | ||
{ | ||
_id: uuid(), | ||
firstName: "Adarsh", | ||
lastName: "Balika", | ||
username: "adarshbalika", | ||
password: "adarshBalika123", | ||
lastName: "Wick", | ||
firstName: "John", | ||
username: "johnwick", | ||
password: "johnWick", | ||
createdAt: formatDate(), | ||
updatedAt: formatDate(), | ||
email: "[email protected]", | ||
}, | ||
]; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import PropTypes from "prop-types"; | ||
|
||
export const Compose = ({ components, children }) => { | ||
return ( | ||
<> | ||
{components.reduceRight((acc, Comp) => { | ||
return <Comp>{acc}</Comp>; | ||
}, children)} | ||
</> | ||
); | ||
}; | ||
|
||
Compose.propTypes = { | ||
children: PropTypes.node, | ||
components: PropTypes.arrayOf(PropTypes.elementType), | ||
}; | ||
|
||
Compose.defaultProps = { | ||
children: <></>, | ||
components: [<></>], | ||
}; |
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,26 +1,37 @@ | ||
import PropTypes from "prop-types"; | ||
import { SignInDialogData } from "data"; | ||
import { useAuthHandler } from "custom-hooks"; | ||
import styles from "./SignInDialog.module.css"; | ||
|
||
import { | ||
DialogActionsCloseIcon, | ||
FormError, | ||
FormButton, | ||
FormHeading, | ||
FormWrapper, | ||
PasswordInput, | ||
DialogActionsCloseIcon, | ||
} from "components"; | ||
|
||
import { | ||
Checkbox, | ||
Dialog, | ||
Checkbox, | ||
TextField, | ||
DialogActions, | ||
DialogContent, | ||
FormControlLabel, | ||
TextField, | ||
} from "@mui/material"; | ||
|
||
const { buttonData } = SignInDialogData; | ||
|
||
export const SignInDialog = ({ openSignInDialog, setOpenSignInDialog }) => { | ||
const { | ||
status, | ||
error, | ||
email, | ||
password, | ||
rememberMe, | ||
handleInputChange, | ||
handleGuestLogInClick, | ||
handleSignInFormSubmit, | ||
} = useAuthHandler(); | ||
|
||
const handleClose = () => { | ||
setOpenSignInDialog(false); | ||
}; | ||
|
@@ -32,33 +43,52 @@ export const SignInDialog = ({ openSignInDialog, setOpenSignInDialog }) => { | |
<DialogContent className={styles.dialogContent}> | ||
<FormHeading headingText="Log In" /> | ||
|
||
{status === "error" && <FormError errorToShow={error} />} | ||
|
||
<FormWrapper> | ||
<TextField | ||
autoFocus | ||
label="Email Address" | ||
type="email" | ||
name="email" | ||
value={email} | ||
label="Email Address" | ||
onChange={handleInputChange} | ||
InputLabelProps={{ shrink: true }} | ||
placeholder="[email protected]" | ||
InputLabelProps={{ | ||
shrink: true, | ||
}} | ||
/> | ||
|
||
<PasswordInput label="Password" placeholder="password" /> | ||
<PasswordInput | ||
name="password" | ||
label="Password" | ||
value={password} | ||
placeholder="password" | ||
onChange={handleInputChange} | ||
/> | ||
|
||
<FormControlLabel | ||
value="remember-me" | ||
control={<Checkbox disableRipple />} | ||
label="Remember me" | ||
aria-label="remember me" | ||
labelPlacement="end" | ||
checked={rememberMe} | ||
aria-label="remember me" | ||
onChange={handleInputChange} | ||
control={<Checkbox disableRipple />} | ||
/> | ||
</FormWrapper> | ||
</DialogContent> | ||
|
||
<DialogActions className={styles.action_logIn}> | ||
{buttonData.map(({ _id, btnText, sxStyles }) => ( | ||
<FormButton key={_id} sxStyles={sxStyles} btnText={btnText} /> | ||
))} | ||
<FormButton | ||
status={status} | ||
btnText="Log In" | ||
onClick={handleSignInFormSubmit} | ||
sxStyles={{ margin: "1rem 0 0.5rem" }} | ||
/> | ||
<FormButton | ||
status={status} | ||
btnText="Log In as a Guest" | ||
onClick={handleGuestLogInClick} | ||
sxStyles={{ margin: "0.5rem 0 0" }} | ||
/> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
|
Oops, something went wrong.
55cc851
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
think-loud – ./
think-loud-git-development-hsnice16.vercel.app
thinkloud.vercel.app
think-loud-hsnice16.vercel.app