Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avatar image component #140

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Avatar image component #140

wants to merge 9 commits into from

Conversation

mAbadsa
Copy link
Collaborator

@mAbadsa mAbadsa commented Feb 15, 2021

#138
UserAvatar Component

  • Create user avatar component to upload user image
  • Create a form with an input type file and preview image.
  • Create a modal box to contain the form.
  • Add upload image button to the user info component.

import Button from '../../../../Components/Button';
import useStyles from './style';

export default function index() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of index you should give this the component name UserAvatar - it'll help with debugging

<div className={classes.formContainer}>
<form className={classes.avtarForm} onSubmit={handleSubmitImage}>
<label htmlFor="file-input-select">
Chose file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose

<form className={classes.avtarForm} onSubmit={handleSubmitImage}>
<label htmlFor="file-input-select">
Chose file
<input
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that you add the accepts attribute to the file input to make sure the user can only upload images

const [selectedFile, setSelectedFile] = useState();
const [errorMsg, setErrorMsg] = useState('');

const previewFile = (file) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome

@mAbadsa mAbadsa requested a review from okjake February 17, 2021 16:56
Copy link
Collaborator

@mariamisa mariamisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solve conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants