Skip to content

Commit 19aabc0

Browse files
authored
fix: 작품 상세 페이지 버그들 수정 (#322)
* fix: 미리보기 같은 페이지 연속 두개 나오던 버그 수정 * fix: 단편극일 경우 화살표 버튼이 안 보이는 버그 수정 * fix: ReviewSummary 별 2개, 4개 안보이던 버그 수정
1 parent 54df21e commit 19aabc0

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

src/components/detail/ReviewSummary.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ const ReviewSummary: React.FC<ReviewSummaryProps> = ({ stats }) => {
199199
dataKey="name"
200200
type="category"
201201
width={100}
202+
interval={0}
203+
tickMargin={6}
202204
tick={(props) => <StarAxisTick {...props} />}
203205
axisLine={false}
204206
tickLine={false}

src/components/detail/preview/Preview.jsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Preview = ({ id, lengthType }) => {
4040
const { width } = useWindowDimensions();
4141
const { isSmallMobile } = useWindowDimensions().widthConditions;
4242

43-
// 단편극: 1장까지만, 장편극: 3장까지만
43+
// 단편극: 2장까지만, 장편극: 4장까지만
4444
const showThreshold = lengthType === "SHORT" ? 2 : 4;
4545

4646
// for Responsive design
@@ -142,6 +142,7 @@ const Preview = ({ id, lengthType }) => {
142142
// showThreshold까지의 모든 페이지 활성화
143143
isPageAvailable = index + 1 <= showThreshold;
144144
} else {
145+
// lengthType === "LONG"
145146
if (width >= 1280) {
146147
isPageAvailable = index + 1 <= showThreshold;
147148
} else if (!isSmallMobile) {
@@ -160,7 +161,11 @@ const Preview = ({ id, lengthType }) => {
160161
id="thumbnail-content"
161162
onClick={() => {
162163
if (isPageAvailable) {
163-
onClickPage(isShort ? showThreshold : index + 1);
164+
onClickPage(
165+
isShort
166+
? Math.min(index + 1, showThreshold)
167+
: index + 1
168+
);
164169
}
165170
}}
166171
>
@@ -169,11 +174,7 @@ const Preview = ({ id, lengthType }) => {
169174
<Page
170175
renderMode="canvas"
171176
pageNumber={
172-
isShort
173-
? showThreshold
174-
: isPageAvailable
175-
? index + 1
176-
: showThreshold
177+
isPageAvailable ? index + 1 : showThreshold
177178
}
178179
width={210}
179180
/>

src/components/detail/preview/PreviewDiv.jsx

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,17 @@ const PreviewDiv = ({
5858
id="page"
5959
onClick={(e) => e.stopPropagation()}
6060
>
61-
{lengthType === "LONG" && (
62-
<img
63-
src={inequalityLeft}
64-
alt="left-btn"
65-
className=" c-pointer"
66-
onClick={() => {
67-
if (selectedPage > 1) {
68-
setSelectedPage(selectedPage - 1);
69-
}
70-
}}
71-
style={selectedPage === 1 ? { opacity: "0" } : null}
72-
/>
73-
)}
61+
<img
62+
src={inequalityLeft}
63+
alt="left-btn"
64+
className=" c-pointer"
65+
onClick={() => {
66+
if (selectedPage > 1) {
67+
setSelectedPage(selectedPage - 1);
68+
}
69+
}}
70+
style={selectedPage === 1 ? { opacity: "0" } : null}
71+
/>
7472

7573
<div className=" p-relative" id="preview-page">
7674
<Page
@@ -102,19 +100,17 @@ const PreviewDiv = ({
102100
</div>
103101
) : null}
104102
</div>
105-
{lengthType === "LONG" && (
106-
<img
107-
src={inequalityRight}
108-
alt="right-btn"
109-
className="c-pointer"
110-
onClick={() => {
111-
if (selectedPage < showThreshold) {
112-
setSelectedPage(selectedPage + 1);
113-
}
114-
}}
115-
style={selectedPage === showThreshold ? { opacity: "0" } : null}
116-
/>
117-
)}
103+
<img
104+
src={inequalityRight}
105+
alt="right-btn"
106+
className="c-pointer"
107+
onClick={() => {
108+
if (selectedPage < showThreshold) {
109+
setSelectedPage(selectedPage + 1);
110+
}
111+
}}
112+
style={selectedPage === showThreshold ? { opacity: "0" } : null}
113+
/>
118114
</div>
119115
</div>
120116
</div>

0 commit comments

Comments
 (0)