-
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 profile page and edit profile dialog (#5)
- Loading branch information
Showing
20 changed files
with
454 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from "react"; | ||
|
||
export const LinkIcon = (props) => { | ||
return ( | ||
<svg height="48" width="48" {...props}> | ||
<path d="M22.5 34H14Q9.75 34 6.875 31.125Q4 28.25 4 24Q4 19.75 6.875 16.875Q9.75 14 14 14H22.5V17H14Q11 17 9 19Q7 21 7 24Q7 27 9 29Q11 31 14 31H22.5ZM16.25 25.5V22.5H31.75V25.5ZM25.5 34V31H34Q37 31 39 29Q41 27 41 24Q41 21 39 19Q37 17 34 17H25.5V14H34Q38.25 14 41.125 16.875Q44 19.75 44 24Q44 28.25 41.125 31.125Q38.25 34 34 34Z" /> | ||
</svg> | ||
); | ||
}; |
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
142 changes: 142 additions & 0 deletions
142
src/components/dialog/edit-profile-dialog/EditProfileDialog.jsx
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,142 @@ | ||
import { useState } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { BIO_MAX_CHARACTERS } from "utils"; | ||
import { FilledAccountCircleIcon } from "assets"; | ||
import styles from "./EditProfileDialog.module.css"; | ||
|
||
import { CustomButton, DialogActionsCloseIcon, FormWrapper } from "components"; | ||
import { | ||
Box, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
InputAdornment, | ||
TextField, | ||
Typography, | ||
} from "@mui/material"; | ||
|
||
export const EditProfileDialog = ({ | ||
openEditProfileDialog, | ||
setOpenEditProfileDialog, | ||
newProfileData, | ||
setNewProfileData, | ||
}) => { | ||
const [bioText, setBioText] = useState(newProfileData.bio); | ||
|
||
const handleBioTextChange = (event) => { | ||
if (BIO_MAX_CHARACTERS - event.target.value.length >= 0) { | ||
setBioText(event.target.value); | ||
setNewProfileData((prevData) => ({ | ||
...prevData, | ||
bio: event.target.value.trim(), | ||
})); | ||
} | ||
}; | ||
|
||
const handleNewProfileDataChange = (event) => { | ||
setNewProfileData((prevData) => ({ | ||
...prevData, | ||
[event.target.name]: event.target.value.trim(), | ||
})); | ||
}; | ||
|
||
const handleClose = () => { | ||
setOpenEditProfileDialog(false); | ||
}; | ||
|
||
return ( | ||
<Dialog | ||
open={openEditProfileDialog} | ||
onClose={handleClose} | ||
className={styles.dialogContainer} | ||
> | ||
<Box display="flex" alignItems="center"> | ||
<DialogActionsCloseIcon handleClose={handleClose} /> | ||
|
||
<Typography component="h1" fontWeight="bold" variant="h4"> | ||
Edit | ||
</Typography> | ||
</Box> | ||
|
||
<DialogContent className={styles.dialogContent}> | ||
<Box position="relative" px={1}> | ||
<Box className={styles.background_img}></Box> | ||
<Box ml={2} className={styles.profile_pic}> | ||
<FilledAccountCircleIcon className={styles.accountCircle_icon} /> | ||
</Box> | ||
</Box> | ||
|
||
<FormWrapper> | ||
<TextField | ||
label="Name" | ||
name="name" | ||
type="text" | ||
placeholder="Your Name..." | ||
value={newProfileData.name} | ||
onChange={handleNewProfileDataChange} | ||
InputLabelProps={{ shrink: true }} | ||
/> | ||
|
||
<TextField | ||
label="Bio" | ||
type="text" | ||
multiline | ||
minRows={3} | ||
maxRows={4} | ||
placeholder="Your Bio..." | ||
value={bioText} | ||
onChange={handleBioTextChange} | ||
InputLabelProps={{ shrink: true }} | ||
InputProps={{ | ||
endAdornment: ( | ||
<InputAdornment position="end"> | ||
<Typography component="p" className={styles.bioText_count}> | ||
{`${bioText.length} / ${BIO_MAX_CHARACTERS}`} | ||
</Typography> | ||
</InputAdornment> | ||
), | ||
}} | ||
/> | ||
|
||
<TextField | ||
label="Website URL" | ||
name="websiteURL" | ||
type="url" | ||
value={newProfileData.websiteURL} | ||
onChange={handleNewProfileDataChange} | ||
placeholder="Your Website URL..." | ||
InputLabelProps={{ shrink: true }} | ||
/> | ||
</FormWrapper> | ||
</DialogContent> | ||
|
||
<DialogActions className={styles.action_save}> | ||
<CustomButton className={styles.btn_save} onClick={handleClose}> | ||
Save | ||
</CustomButton> | ||
</DialogActions> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
EditProfileDialog.propTypes = { | ||
openEditProfileDialog: PropTypes.bool, | ||
setOpenEditProfileDialog: PropTypes.func, | ||
newProfileData: PropTypes.shape({ | ||
name: PropTypes.string, | ||
bio: PropTypes.string, | ||
websiteURL: PropTypes.string, | ||
}), | ||
setNewProfileData: PropTypes.func, | ||
}; | ||
|
||
EditProfileDialog.defaultProps = { | ||
openEditProfileDialog: false, | ||
setOpenEditProfileDialog: () => {}, | ||
newProfileData: { | ||
name: "", | ||
bio: "", | ||
websiteURL: "", | ||
}, | ||
setNewProfileData: () => {}, | ||
}; |
61 changes: 61 additions & 0 deletions
61
src/components/dialog/edit-profile-dialog/EditProfileDialog.module.css
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,61 @@ | ||
button.btn_save { | ||
font-size: 1.4rem; | ||
padding: 0.5rem 1.2rem; | ||
} | ||
|
||
div.action_save { | ||
padding: 0.5rem 2rem 1rem; | ||
} | ||
|
||
div.dialogContent { | ||
padding: 0; | ||
} | ||
|
||
div.dialogContent form { | ||
margin-top: 4rem; | ||
padding: 2rem 2rem 0; | ||
} | ||
|
||
div.dialogContent textarea[placeholder="Your Bio..."] { | ||
line-height: 1.5em; | ||
margin-top: 1rem; | ||
} | ||
|
||
p.bioText_count { | ||
font-size: 1.4rem; | ||
position: absolute; | ||
transform: translate(-100%, 20%); | ||
top: 0; | ||
} | ||
|
||
.accountCircle_icon { | ||
fill: var(--COLOR-TEXT); | ||
height: 100%; | ||
margin: -0.1rem 0 0 -0.1rem; | ||
width: 100%; | ||
} | ||
|
||
.accountCircle_icon > path { | ||
transform: translate(-8%, -8%) scale(2.2); | ||
} | ||
|
||
.background_img { | ||
background-color: var(--COLOR-SEARCH-INNER-SHADOW); | ||
height: 14rem; | ||
width: 100%; | ||
} | ||
|
||
.dialogContainer > div:nth-child(3) > div { | ||
color: var(--COLOR-TEXT); | ||
width: 55rem; | ||
} | ||
|
||
.profile_pic { | ||
background-color: var(--COLOR-SEARCH-BACKGROUND); | ||
border: thick solid var(--COLOR-SEARCH-BACKGROUND); | ||
border-radius: 50%; | ||
height: 10rem; | ||
position: absolute; | ||
transform: translateY(-50%); | ||
width: 10rem; | ||
} |
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
.aside { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 27rem; | ||
} | ||
|
||
.ellipsisIcon { | ||
|
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { LeftSideNavbarData } from "./left-side-navbar-data"; | ||
export { ProfileData } from "./profile-data"; | ||
export { SignInDialogData } from "./sign-in-dialog-data"; |
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,18 @@ | ||
import { v4 as uuid } from "uuid"; | ||
|
||
export const ProfileData = { | ||
tabsOptions: [ | ||
{ | ||
_id: uuid(), | ||
value: "Broadcasts", | ||
}, | ||
{ | ||
_id: uuid(), | ||
value: "Likes", | ||
}, | ||
{ | ||
_id: uuid(), | ||
value: "Replies", | ||
}, | ||
], | ||
}; |
Oops, something went wrong.
5d4634c
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 – ./
thinkloud.vercel.app
think-loud-hsnice16.vercel.app
think-loud-git-development-hsnice16.vercel.app