From 66fd7456756d65f7c55a7baf19a3be669713e843 Mon Sep 17 00:00:00 2001 From: Brok3Turtl3 Date: Wed, 17 Apr 2024 18:00:47 -0400 Subject: [PATCH] Updated button styling --- .../pages/EditProfilePage/EditProfilePage.tsx | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/client/src/pages/EditProfilePage/EditProfilePage.tsx b/client/src/pages/EditProfilePage/EditProfilePage.tsx index 0257e26..3a07c94 100644 --- a/client/src/pages/EditProfilePage/EditProfilePage.tsx +++ b/client/src/pages/EditProfilePage/EditProfilePage.tsx @@ -1,4 +1,10 @@ -import React, { useEffect, useState, ChangeEvent, FormEvent } from "react"; +import React, { + useEffect, + useState, + useRef, + ChangeEvent, + FormEvent, +} from "react"; import { useAppSelector, useAppDispatch } from "../../app/hooks"; import { fetchUserProfile, @@ -10,6 +16,7 @@ const EditProfilePage = () => { const dispatch = useAppDispatch(); const { profile, status } = useAppSelector((state) => state.userProfile); const userID = useAppSelector((state) => state.user.userData?._id); + const fileInputRef = useRef(null); const [formData, setFormData] = useState({ fullName: "", @@ -68,6 +75,10 @@ const EditProfilePage = () => { dispatch(uploadProfilePicture({ formData, userID })); }; + const handleFileInputClick = () => { + fileInputRef.current?.click(); + }; + if (status === "loading" || !userID) { return
Loading...
; } @@ -120,7 +131,7 @@ const EditProfilePage = () => { />