Skip to content

Commit 9bc72a8

Browse files
committed
雅ボタンにisAnimationDisabled追加
1 parent 9f6e61f commit 9bc72a8

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

frontend/src/components/GifButton.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface GifButtonProps {
99
afterSrc: string;
1010
animationDuration?: number;
1111
initialIsClicked?: boolean;
12+
isAnimationDisabled?: boolean;
1213
onClick?: () => void;
1314
onCancel?: () => void;
1415
className?: string;
@@ -21,6 +22,7 @@ const GifButton = ({
2122
afterSrc,
2223
animationDuration,
2324
initialIsClicked,
25+
isAnimationDisabled = false,
2426
onClick,
2527
onCancel,
2628
className,
@@ -32,6 +34,7 @@ const GifButton = ({
3234
const [isAnimationPlaying, setIsAnimationPlaying] = useState(false);
3335

3436
const clickButton = () => {
37+
if (isAnimationDisabled) return;
3538
setIsAnimationPlaying(true);
3639
setTimeout(() => {
3740
setIsAnimationPlaying(false);
@@ -40,6 +43,7 @@ const GifButton = ({
4043
};
4144

4245
const cancelButton = () => {
46+
if (isAnimationDisabled) return;
4347
setIsAnimationPlaying(false);
4448
setIsClicked(false);
4549
};

frontend/src/components/MiyabiButton.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ interface MiyabiButtonProps {
66
size?: 'small' | 'medium' | 'large';
77
className?: string;
88
initialIsClicked?: boolean;
9+
isAnimationDisabled?: boolean;
910
onClick?: () => void;
1011
onCancel?: () => void;
1112
}
@@ -16,6 +17,7 @@ const MiyabiButton = ({
1617
onCancel,
1718
className,
1819
initialIsClicked = false,
20+
isAnimationDisabled = false,
1921
}: MiyabiButtonProps) => {
2022
return (
2123
<GifButton
@@ -27,6 +29,7 @@ const MiyabiButton = ({
2729
initialIsClicked={initialIsClicked}
2830
onClick={onClick}
2931
onCancel={onCancel}
32+
isAnimationDisabled={isAnimationDisabled}
3033
className={`${className} scale-150 hover:scale-[1.6]`}
3134
/>
3235
);

frontend/src/components/Post.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ const Post = ({ post, className, onDelete }: PostProps) => {
142142
}
143143
}}
144144
initialIsClicked={post.miyabiIsClicked}
145+
isAnimationDisabled={!isLoggedIn}
145146
className='mr-0'
146147
/>
147148
</div>

0 commit comments

Comments
 (0)