Skip to content

Commit 8e679d3

Browse files
authored
Merge pull request #41 from happbob/feat/OD-3
Refactor: any 타입 변수 및 속성 명시적으로 수정
2 parents 18e9e91 + 4860103 commit 8e679d3

18 files changed

Lines changed: 57 additions & 39 deletions

File tree

src/components/BottomSheet/dto.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export interface BottomSheetProps {
1+
export interface BottomSheetProps<T = any> {
22
isOpenBottomSheet: boolean; // BottomSheet state
3-
isHandlerVisible?: boolean; // 핸들러 여부 설정
4-
Component: React.ComponentType<any>; // BottomSheet 내부에 전달할 컴포넌트
5-
componentProps?: any; // props가 있는 경우 객체 형태로 전달
3+
isHandlerVisible?: boolean; // 핸들러 가시성 설정(기본값 true)
4+
Component: React.ComponentType<T>; // BottomSheet 내부에 전달할 컴포넌트
5+
componentProps?: T; // props가 있는 경우 객체 형태로 전달
66
onCloseBottomSheet: () => void; // BottomSheet을 닫는 함수
77
initialTab?: 'likes' | 'comments'; // 추가: initialTab 속성
88
}

src/components/BottomSheetMenu/dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SheetItemWithDivider에서 사용되는 Items 배열 요소
22
export interface SheetItemDto {
33
text: string;
4-
action: () => any;
4+
action: () => void;
55
icon?: string; // svg를 import하여 값으로 사용
66
}
77

src/components/Cards/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useRef, useState } from 'react';
2-
import { Swiper, SwiperSlide } from 'swiper/react';
2+
import { Swiper, SwiperRef, SwiperSlide } from 'swiper/react';
33
import { Pagination } from 'swiper/modules';
44
import 'swiper/css';
55
import 'swiper/css/pagination';
@@ -13,9 +13,9 @@ interface CardsProps {
1313
}
1414

1515
const Cards: React.FC<CardsProps> = ({ onRemoveMatching }) => {
16-
const swiperRef = useRef<any>(null); // Swiper 인스턴스 참조
17-
const [relationships, setRelationships] = useState<Relationship[]>([]); // 매칭 요청 데이터를 상태로 관리
18-
const [slidesVisibility, setSlidesVisibility] = useState<boolean[]>([]); // 각 슬라이드의 가시성을 관리
16+
const swiperRef = useRef<SwiperRef | null>(null); // Swiper 인스턴스 참조
17+
const [relationships, setRelationships] = useState<Relationship[]>([]); // 매칭 요청 데이터를 상태로 관리
18+
const [slidesVisibility, setSlidesVisibility] = useState<boolean[]>([]); // 각 슬라이드의 가시성을 관리
1919

2020
const fetchData = async () => {
2121
try {

src/components/Comment/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { StyledText } from '../Text/StyledText';
22
import theme from '../../styles/theme';
33
import { CommentLayout, SendContainer, CommentTextarea, SendImg } from './styles';
44
import Send from '/Send.svg';
5-
import { useEffect, useRef, useState } from 'react';
5+
import React, { useEffect, useRef, useState } from 'react';
66
import { CommentProps } from './dto';
77

88
const Comment: React.FC<CommentProps> = ({ content, sendComment }) => {
@@ -17,7 +17,7 @@ const Comment: React.FC<CommentProps> = ({ content, sendComment }) => {
1717
}
1818
}, [comment]);
1919

20-
const onChangeComment = (e: any) => {
20+
const onChangeComment = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
2121
if (e.target.value.length >= 100) {
2222
return;
2323
} else {
@@ -26,14 +26,14 @@ const Comment: React.FC<CommentProps> = ({ content, sendComment }) => {
2626
};
2727

2828
// textarea에서 enter 입력 시 실행
29-
const onKeyDown = (e: any): void => {
29+
const onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>): void => {
3030
if (comment === '') {
3131
e.preventDefault();
3232
return;
3333
}
3434
if (e.key === 'Enter' && !e.shiftKey) {
3535
e.preventDefault();
36-
sendComment(e.target.value);
36+
sendComment(e.currentTarget.value);
3737
setComment('');
3838
}
3939
};

src/pages/Chats/ChatRoom/ChatBox/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ChatBox: React.FC = () => {
3434
}
3535
}, []);
3636

37-
const onChangeMessage = (e: any): void => {
37+
const onChangeMessage = (e: React.ChangeEvent<HTMLTextAreaElement>): void => {
3838
setNewMessage(e.target.value);
3939
};
4040
const sendNewMessage = (): void => {
@@ -49,7 +49,7 @@ const ChatBox: React.FC = () => {
4949
}
5050
};
5151

52-
const onKeyDown = (e: any): void => {
52+
const onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>): void => {
5353
if (e.key === 'Enter' && !e.shiftKey) {
5454
e.preventDefault();
5555
sendNewMessage();

src/pages/Chats/ChatRoom/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ const ChatRoom: React.FC = () => {
211211
},
212212
};
213213

214-
const kebabMenuBottomSheet: BottomSheetProps = {
214+
const kebabMenuBottomSheet: BottomSheetProps<BottomSheetMenuProps> = {
215215
isOpenBottomSheet: isOpenMenu,
216216
isHandlerVisible: true,
217217
Component: BottomSheetMenu,

src/pages/Home/BottomSheets/HeartBottomSheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const HeartBottomSheet: React.FC = () => {
4646
},
4747
};
4848

49-
const heartBottomSheet: BottomSheetProps = {
49+
const heartBottomSheet: BottomSheetProps<CommentProps> = {
5050
isOpenBottomSheet: isOpenHeartBottomSheet,
5151
Component: Comment,
5252
componentProps: requestCommentProps,

src/pages/Home/BottomSheets/MeatballBottomSheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const MeatballBottomSheet: React.FC = () => {
3535
marginBottom: '3.125rem',
3636
};
3737

38-
const meatballBottomSheet: BottomSheetProps = {
38+
const meatballBottomSheet: BottomSheetProps<BottomSheetMenuProps> = {
3939
isOpenBottomSheet: isOpenMeatballBottomSheet,
4040
Component: BottomSheetMenu,
4141
componentProps: meatballBottomSheetMenuProps,

src/pages/Home/BottomSheets/PostCommentBottomSheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const PostCommentBottomSheet: React.FC = () => {
4646
},
4747
};
4848

49-
const postCommentBottomSheet: BottomSheetProps = {
49+
const postCommentBottomSheet: BottomSheetProps<CommentProps> = {
5050
isOpenBottomSheet: isOpenPostCommentBottomSheet,
5151
Component: Comment,
5252
componentProps: postCommentProps,

src/pages/Home/BottomSheets/ReportBottomSheet.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ const ReportBottomSheet: React.FC = () => {
9595
)}
9696
</div>
9797
),
98-
componentProps: reportBottomSheetMenuProps,
9998
onCloseBottomSheet: () => {
10099
setIsOpenReportBottomSheet(false);
101100
setShowInput(false);

0 commit comments

Comments
 (0)