Skip to content

Commit d3bb439

Browse files
committed
feat: MemeQuizPage의 버튼에 애니메이션 효과 추가
- MemeQuizStart 및 QuizStep 컴포넌트의 버튼을 motion.button으로 변경하여 애니메이션 효과를 추가함 - 버튼 클릭 시 스케일 효과를 적용하여 사용자 경험을 향상시킴
1 parent 5859017 commit d3bb439

File tree

6 files changed

+37
-13
lines changed

6 files changed

+37
-13
lines changed

apps/web/src/pages/MemeQuizPage/components/MemeQuizStart/MemeQuizStart.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const ButtonWrapper = styled(motion.div)`
5353
margin: 0 auto;
5454
`;
5555

56-
const StartButton = styled.button`
56+
const StartButton = styled(motion.button)`
5757
width: 100%;
5858
height: 52px;
5959
background-color: ${({ theme }) => theme.palette.gray['gray-10']};

apps/web/src/pages/MemeQuizPage/components/MemeQuizStart/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ const MemeQuizStart = ({ onNext }: MemeQuizStartProps) => {
5555
stiffness: 100,
5656
}}
5757
>
58-
<StartButton onClick={onNext} style={{ position: 'relative' }}>
58+
<StartButton
59+
onClick={onNext}
60+
style={{ position: 'relative' }}
61+
whileTap={{ scale: 0.95 }}
62+
>
5963
밈퀴즈 시작하기
6064
</StartButton>
6165
</ButtonWrapper>

apps/web/src/pages/MemeQuizPage/components/QuizStep/QuizResultModal.styles.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ const NextButton = styled(motion.button)`
6868
${({ theme }) => theme.typography.title.subhead1};
6969
color: ${({ theme }) => theme.palette.common.white};
7070
cursor: pointer;
71-
72-
&:hover {
73-
opacity: 0.9;
74-
}
7571
`;
7672

7773
export {

apps/web/src/pages/MemeQuizPage/components/QuizStep/QuizResultModal.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,18 @@ const QuizResultModal = ({
100100
<NextButton
101101
initial={{ y: 20, opacity: 0 }}
102102
animate={{ y: 0, opacity: 1 }}
103-
transition={{ duration: 0.4, delay: 0.8 }}
104-
whileHover={{ scale: 1.02 }}
105-
whileTap={{ scale: 0.98 }}
103+
whileTap={{
104+
scale: 0.98,
105+
transition: {
106+
type: 'spring',
107+
stiffness: 400,
108+
damping: 17,
109+
},
110+
}}
111+
transition={{
112+
duration: 0.4,
113+
delay: 0.8,
114+
}}
106115
onClick={onNext}
107116
>
108117
다음 퀴즈 풀기

apps/web/src/pages/MemeQuizPage/components/QuizStep/QuizStep.styles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import styled from '@emotion/styled';
22
import { keyframes } from '@emotion/react';
3+
import { motion } from 'motion/react';
34

45
const shimmer = keyframes`
56
0% {
@@ -75,7 +76,7 @@ const AnswerContainer = styled.div`
7576
margin-bottom: 108px;
7677
`;
7778

78-
const Button = styled.button<{ isSelected?: boolean }>`
79+
const Button = styled(motion.button)<{ isSelected?: boolean }>`
7980
width: 100%;
8081
height: 50px;
8182
padding: 0 20px;
@@ -89,7 +90,6 @@ const Button = styled.button<{ isSelected?: boolean }>`
8990
background-color: ${({ theme, isSelected }) =>
9091
isSelected ? theme.palette.main.pink[95] : theme.palette.gray['gray-9']};
9192
cursor: pointer;
92-
transition: all 0.2s ease-in-out;
9393
`;
9494

9595
const ButtonIcon = styled.div<{ isSelected?: boolean }>`
@@ -122,7 +122,7 @@ const BottomContainer = styled.div`
122122
justify-content: center;
123123
`;
124124

125-
const BottomButton = styled.button<{ disabled?: boolean }>`
125+
const BottomButton = styled(motion.button)<{ disabled?: boolean }>`
126126
width: 100%;
127127
height: 52px;
128128
border: none;

apps/web/src/pages/MemeQuizPage/components/QuizStep/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ const QuizStep = ({
101101
key={index}
102102
onClick={() => handleAnswerSelect(index)}
103103
isSelected={isSelected}
104+
whileTap={{ scale: 0.98 }}
105+
transition={{
106+
type: 'spring',
107+
stiffness: 400,
108+
damping: 17,
109+
}}
104110
>
105111
<ButtonIcon isSelected={isSelected}>
106112
<LinkCopiedIcon width={20} height={20} />
@@ -117,7 +123,16 @@ const QuizStep = ({
117123
</Content>
118124

119125
<BottomContainer>
120-
<BottomButton onClick={handleNext} disabled={selectedAnswer === null}>
126+
<BottomButton
127+
onClick={handleNext}
128+
disabled={selectedAnswer === null}
129+
whileTap={!selectedAnswer ? {} : { scale: 0.98 }}
130+
transition={{
131+
type: 'spring',
132+
stiffness: 400,
133+
damping: 17,
134+
}}
135+
>
121136
다음
122137
</BottomButton>
123138
</BottomContainer>

0 commit comments

Comments
 (0)