Skip to content
Snippets Groups Projects
Unverified Commit bea8dc73 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Solved profile issues (#4657)

parent 3c247b96
Branches
Tags
No related merge requests found
......@@ -19,16 +19,29 @@ export default function SetAvatar({ user }) {
// Editor Modal
const [show, setShow] = useState(false);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
// Cropped Avatar Upload
const [avatar, setAvatar] = useState();
const [scale, setScale] = useState();
const handleShow = () => {
setShow(true);
};
const handleClose = () => {
document.getElementById('avatarUpload').value = '';
setAvatar(undefined);
setScale(undefined);
setShow(false);
};
const handleNewAvatar = (e) => {
const { files } = e.target;
if (files.length > 0) {
handleShow();
setAvatar(e.target.files[0]);
}
};
const handleScale = (e) => {
setScale(parseFloat(e.target.value));
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment