Skip to content

Commit

Permalink
Fix: 마이페이지 온도 동적 스타일링 버그 해결
Browse files Browse the repository at this point in the history
Related to: #408
  • Loading branch information
choiseona committed Jul 9, 2024
1 parent c0d42b0 commit 5d2502b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/components/MyPage/MyPage/Temperature/Temperature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ interface Props {
}

function Temperature({ temperature }: Props) {
temperature += 36.5;

if (temperature <= 0) {
temperature = 0;
} else if (temperature >= 100) {
temperature = 100;
}

const temperatureColorConditions = [
{ max: 10, color: "#7EC7FC" },
{ max: 20, color: "#72EF86" },
Expand Down
13 changes: 12 additions & 1 deletion src/hooks/queries/useProfileQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,20 @@ import { useMutation, useQuery } from "react-query";
import { useNavigate } from "react-router-dom";

export const useGetMyProfile = () => {
const adjustTemperature = (data: MyProfileDataType) => {
let progressBar = data.progressBar + 36.5;
if (progressBar < 0) {
progressBar = 0;
} else if (progressBar > 100) {
progressBar = 100;
}
return { ...data, progressBar };
};

const { data, isLoading } = useQuery<MyProfileDataType>({
queryKey: [QUERY_KEY.MY_PROFILE],
queryFn: () => getMyPageProfile(),
queryFn: getMyPageProfile,
select: adjustTemperature,
});

return { data, isLoading };
Expand Down

0 comments on commit 5d2502b

Please sign in to comment.