Skip to content

Commit efb8b16

Browse files
authored
Fix: 마이페이지 온도 동적 스타일링 버그 해결 (#410)
Related to: #408
1 parent c0d42b0 commit efb8b16

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/components/MyPage/MyPage/Temperature/Temperature.tsx

-8
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ interface Props {
55
}
66

77
function Temperature({ temperature }: Props) {
8-
temperature += 36.5;
9-
10-
if (temperature <= 0) {
11-
temperature = 0;
12-
} else if (temperature >= 100) {
13-
temperature = 100;
14-
}
15-
168
const temperatureColorConditions = [
179
{ max: 10, color: "#7EC7FC" },
1810
{ max: 20, color: "#72EF86" },

src/hooks/queries/useProfileQuery.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,20 @@ import { useMutation, useQuery } from "react-query";
2121
import { useNavigate } from "react-router-dom";
2222

2323
export const useGetMyProfile = () => {
24+
const adjustTemperature = (data: MyProfileDataType) => {
25+
let progressBar = data.progressBar + 36.5;
26+
if (progressBar < 0) {
27+
progressBar = 0;
28+
} else if (progressBar > 100) {
29+
progressBar = 100;
30+
}
31+
return { ...data, progressBar };
32+
};
33+
2434
const { data, isLoading } = useQuery<MyProfileDataType>({
2535
queryKey: [QUERY_KEY.MY_PROFILE],
26-
queryFn: () => getMyPageProfile(),
36+
queryFn: getMyPageProfile,
37+
select: adjustTemperature,
2738
});
2839

2940
return { data, isLoading };

0 commit comments

Comments
 (0)