Skip to content

Commit 56c36d1

Browse files
committed
Refactor: CommentBottomSheet 리팩토링
1 parent c15cc99 commit 56c36d1

5 files changed

Lines changed: 23 additions & 23 deletions

File tree

File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/CommentBottomSheet/index.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { StyledText } from '../Text/StyledText';
2-
import theme from '../../styles/theme';
1+
import { StyledText } from '@components/Text/StyledText';
2+
import theme from '@styles/theme';
33

4-
import BottomSheet from '../BottomSheet';
5-
import Comment from '../Comment';
6-
import { BottomSheetProps } from '../BottomSheet/dto';
7-
import { CommentBottomSheetProps } from './dto';
4+
import BottomSheet from '@components/BottomSheet';
5+
import Comment from './Comment/index';
6+
import type { BottomSheetProps } from '@components/BottomSheet/dto';
7+
import type { CommentBottomSheetProps } from './dto';
8+
import closeIcon from '@assets/default/modal-close-white.svg';
89

910
import {
1011
CommentBottomSheetLayout,
@@ -13,32 +14,32 @@ import {
1314
CommentModalHeader,
1415
CommentModalLayout,
1516
CommentModalWrapper,
16-
XButton,
17+
CloseButton,
1718
} from './styles';
1819

1920
const CommentBottomSheet: React.FC<CommentBottomSheetProps> = ({
2021
isBottomSheetOpen,
2122
commentProps,
2223
handleCloseBottomSheet,
2324
}) => {
24-
const bottomSheetProps: BottomSheetProps = {
25-
isOpenBottomSheet: isBottomSheetOpen,
26-
Component: Comment,
27-
componentProps: commentProps,
28-
onCloseBottomSheet: handleCloseBottomSheet,
29-
};
30-
3125
const handleBackgroundClick = (e: React.MouseEvent<HTMLDivElement>) => {
3226
e.stopPropagation();
3327
if (e.target === e.currentTarget) {
3428
handleCloseBottomSheet();
3529
}
3630
};
3731

38-
const handleButtonClick = () => {
32+
const handleCloseButtonClick = () => {
3933
handleCloseBottomSheet();
4034
};
4135

36+
const bottomSheetProps: BottomSheetProps = {
37+
isOpenBottomSheet: isBottomSheetOpen,
38+
Component: Comment,
39+
componentProps: commentProps,
40+
onCloseBottomSheet: handleCloseBottomSheet,
41+
};
42+
4243
return (
4344
<>
4445
{/* 모바일 & 태블릿 UI */}
@@ -54,7 +55,9 @@ const CommentBottomSheet: React.FC<CommentBottomSheetProps> = ({
5455
<StyledText $textTheme={{ style: 'heading1-bold' }} color={theme.colors.white}>
5556
메시지 보내기
5657
</StyledText>
57-
<XButton onClick={handleButtonClick} />
58+
<CloseButton onClick={handleCloseButtonClick}>
59+
<img src={closeIcon} alt="닫기" />
60+
</CloseButton>
5861
</CommentModalHeader>
5962
<CommentModalBox>
6063
<Comment {...commentProps} isModal={true} />

src/components/CommentBottomSheet/styles.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import styled from 'styled-components';
2-
import CloseIcon from '../../assets/default/modal-close-white.svg';
32

43
export const CommentBottomSheetLayout = styled.div`
54
${({ theme }) => theme.visibleOnMobileTablet};
@@ -54,13 +53,11 @@ export const CommentModalBox = styled.section`
5453
width: 100%;
5554
`;
5655

57-
export const XButton = styled.button`
56+
export const CloseButton = styled.button`
5857
width: 1.875rem;
5958
height: 1.875rem;
60-
margin: auto 0 auto auto;
61-
background-image: url(${CloseIcon});
62-
background-repeat: no-repeat;
63-
background-size: 1.875rem;
64-
background-position: center;
59+
display: flex;
60+
justify-content: center;
61+
align-items: center;
6562
opacity: 0.5;
6663
`;

0 commit comments

Comments
 (0)