From 24e5b9d5d2c6a24d0ece7dbf5f6d456171f340e4 Mon Sep 17 00:00:00 2001 From: yunseok Date: Sun, 11 Aug 2024 00:20:54 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=ED=94=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=EC=8A=A4=20=EB=B0=94=20=EC=95=A0=EB=8B=88=EB=A9=94?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ChallengeDetail/Progress.tsx | 27 ++++++++++++++------- src/components/Common/ProgressBar.tsx | 14 +++++++++-- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/components/ChallengeDetail/Progress.tsx b/src/components/ChallengeDetail/Progress.tsx index d71ed13..97b1334 100644 --- a/src/components/ChallengeDetail/Progress.tsx +++ b/src/components/ChallengeDetail/Progress.tsx @@ -1,4 +1,4 @@ -import styled from "styled-components"; +import styled, { keyframes } from "styled-components"; import tw from "twin.macro"; type ProgressProps = { @@ -15,10 +15,7 @@ const Progress = ({ return (
-
+

@@ -46,9 +43,21 @@ const Container = styled.div` w-[1280px] h-[15.41px] rounded-[28px] border-[3px] border-subColor shadow-[black] bg-white `} } - .progress { - ${tw` - h-full rounded-[28px] bg-subColor - `} +`; + +const fillAnimation = (successRate: number) => keyframes` + from { + width: 0; + } + to { + width: ${successRate}%; } `; + +const ProgressFill = styled.div<{ successRate: number }>` + ${tw` + h-full rounded-[28px] bg-subColor + `} + animation: ${({ successRate }) => + fillAnimation(successRate)} 1s ease-out forwards; +`; diff --git a/src/components/Common/ProgressBar.tsx b/src/components/Common/ProgressBar.tsx index c4a84be..271771a 100644 --- a/src/components/Common/ProgressBar.tsx +++ b/src/components/Common/ProgressBar.tsx @@ -1,4 +1,4 @@ -import styled from "styled-components"; +import styled, { keyframes } from "styled-components"; import tw from "twin.macro"; interface ProgressProps { @@ -22,11 +22,20 @@ const Container = styled.div` border-2 border-fontColor3 rounded-[28px] - bg-[whilte] + bg-[white] relative `} `; +const fillAnimation = (rate: number) => keyframes` + from { + width: 0; + } + to { + width: ${rate}%; + } +`; + const Progress = styled.div` width: ${({ rate }) => rate}%; ${tw` @@ -37,4 +46,5 @@ const Progress = styled.div` bg-fontColor3 break-keep `} + animation: ${({ rate }) => fillAnimation(rate)} 1s ease-out forwards; `; From cfad72507859797c90b05bbc4730e8f8ebe53784 Mon Sep 17 00:00:00 2001 From: yunseok Date: Sun, 11 Aug 2024 01:04:40 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=EC=A3=BC=EC=86=8C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MyPage/BadgeBoard.tsx | 2 +- src/components/MyPage/CanaryAuth.tsx | 21 ++++++++++------ src/components/MyPage/CanaryModal.tsx | 2 +- src/components/MyPage/PersonalInfo.tsx | 35 +++++++++++++++----------- src/components/MyPage/PostalCode.tsx | 18 +++++-------- src/pages/MyPage.tsx | 28 +++++++++++++++++---- 6 files changed, 64 insertions(+), 42 deletions(-) diff --git a/src/components/MyPage/BadgeBoard.tsx b/src/components/MyPage/BadgeBoard.tsx index 0fa00f1..254494f 100644 --- a/src/components/MyPage/BadgeBoard.tsx +++ b/src/components/MyPage/BadgeBoard.tsx @@ -125,7 +125,7 @@ const BadgeBoard = () => {

챌린지 달성 뱃지 - 00개의 챌린지를 성공적으로 마쳤어요. 성장하고 계시는군요! + 14개의 챌린지를 성공적으로 마쳤어요. 성장하고 계시는군요!
diff --git a/src/components/MyPage/CanaryAuth.tsx b/src/components/MyPage/CanaryAuth.tsx index 430e34a..45f26cf 100644 --- a/src/components/MyPage/CanaryAuth.tsx +++ b/src/components/MyPage/CanaryAuth.tsx @@ -5,12 +5,17 @@ import { getCanaryStatus } from "../../apis/canary"; import useAuthStore from "../../storage/useAuthStore"; import { useQuery } from "@tanstack/react-query"; -const CanaryAuth = ({ onClick }: { onClick: () => void }) => { +type CanaryStatus = { + applyStatus: number; + onClick: () => void; +}; + +const CanaryAuth = ({ + applyStatus, + onClick, + isLoading, +}: CanaryStatus & { isLoading: boolean }) => { const { userData, accessToken } = useAuthStore.getState(); - const { data: applyStatus, isLoading } = useQuery({ - queryKey: ["getCanaryStatus", userData.id, accessToken], - queryFn: () => getCanaryStatus(userData.id!, accessToken!), - }); if (isLoading) return
; @@ -23,7 +28,7 @@ const CanaryAuth = ({ onClick }: { onClick: () => void }) => { 멘토링을 신청할 수 있어요.
- {applyStatus.data === 0 && ( + {applyStatus === 0 && (