Skip to content

Commit

Permalink
[#86] fix: fix profile image path
Browse files Browse the repository at this point in the history
  • Loading branch information
suzinxix committed Mar 18, 2023
1 parent 3e27430 commit 255d070
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 43 deletions.
1 change: 0 additions & 1 deletion bowwowcare/src/context/ThemeProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ function ThemeProvider({ children }) {
const [myTheme, setMyTheme] = useState(0);
const [ThemeMode, setThemeMode] = useState(theme[0]);


useEffect(() => {
if(isLogin()){
userService.getUserBoard().then((response) => {
Expand Down
23 changes: 0 additions & 23 deletions bowwowcare/src/theme/theme.js

This file was deleted.

27 changes: 9 additions & 18 deletions bowwowcare/src/views/AdditionPage/AdditionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Button from "../../components/Button";
import Alert from "../../components/Alert";
import { ThemeContext } from "../../context/ThemeProvider";
import { colorVariants } from "../../utils/Dictionary";
import HAPPY from "../../assets/images/happy.png"

function AdditionPage() {
let navigate = useNavigate();
Expand Down Expand Up @@ -85,7 +86,6 @@ function AdditionPage() {
}
});
} else {
// TODO: 수정 API 추가
}
} else {
handleOpen();
Expand All @@ -101,27 +101,18 @@ function AdditionPage() {
<div className="container mx-auto px-8 w-screen h-screen">
<Header />
<div className="flex flex-col justify-center m-12">
<div className="w-full mb-10 flex justify-center">
<div className="w-full mb-6 flex justify-center">
<div className="flex flex-col ">
<div className="rounded-full border w-20 h-20 ml-4">
{fileImg && (
<img
src={
typeof fileImg === "string"
? fileImg
: URL.createObjectURL(fileImg)
}
<label className="font-bold " htmlFor="profileImg">
<div className="rounded-full w-20 h-20 ml-4">
<img
src={!fileImg ? HAPPY : typeof fileImg === "string" ? fileImg : URL.createObjectURL(fileImg)}
alt="프로필 이미지"
className="rounded-full w-20 h-20"
></img>
)}
</div>

<div className="mt-3">
<label className="font-bold " htmlFor="profileImg">
프로필 이미지 {pet ? "변경" : "추가"}
</label>
<input
</label>
<input
type="file"
id="profileImg"
name="avatar"
Expand All @@ -130,7 +121,6 @@ function AdditionPage() {
onChange={handleChange}
style={{ display: "none" }}
/>
</div>
</div>
</div>

Expand All @@ -141,6 +131,7 @@ function AdditionPage() {
colorVariants["border" + themeMode]
}`}
value={petname}
placeholder="반려견의 이름을 입력해주세요."
onChange={(e) => {
setPetName(e.target.value);
}}
Expand Down
3 changes: 2 additions & 1 deletion bowwowcare/src/views/UserPage/UserPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ThemeSwitcher from "../../components/ThemeSwitcher";
import userService from "../../services/user.service";
import { API_URL } from "../../Config";
import authHeader from "../../services/auth-header";
import HAPPY from "../../assets/images/happy.png"

function UserPage() {
const [rewards, setRewards] = useState(0);
Expand Down Expand Up @@ -71,7 +72,7 @@ function UserPage() {
<div className="rounded-full w-12 h-12 border" >
<label htmlFor="profileImg">
<img
src={typeof fileImg === "string" ? fileImg : URL.createObjectURL(fileImg)}
src={!fileImg ? HAPPY : typeof fileImg === "string" ? fileImg : URL.createObjectURL(fileImg)}
className="rounded-full w-12 h-12" alt="유저 이미지">
</img>
</label>
Expand Down

0 comments on commit 255d070

Please sign in to comment.