Skip to content

Commit abffccc

Browse files
authored
Merge pull request #185 from Codeit-FE18-Part3-Team4/feature/#55
[#55] 사이드바 수정
2 parents 6be3ce5 + 426a866 commit abffccc

3 files changed

Lines changed: 56 additions & 36 deletions

File tree

src/components/dashboard-layout/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DashboardSideBar from "@/components/dashboard-side-bar/dashboard-side-bar";
22
import { useSsrResponsive } from "@/hooks/use-ssr-responsive";
33
import { useRouter } from "next/router";
4-
import { ReactNode, useState } from "react";
4+
import { ReactNode, useEffect, useState } from "react";
55
import CreateDashboardSheet from "../dashboard-create/create-dashboard-sheet";
66
import NavigationBar from "../navigationBar/navigation-bar";
77
import AccountSettingModal from "../profile-setting-modal";
@@ -32,6 +32,18 @@ export default function DashboardLayout({ children }: DashboardLayoutProps) {
3232
setIsMobileSidebarOpen(false);
3333
};
3434

35+
useEffect(() => {
36+
if (isMobileSidebarOpen) {
37+
document.body.style.position = "fixed";
38+
document.body.style.width = "100%";
39+
} else {
40+
document.body.style.position = "";
41+
}
42+
return () => {
43+
document.body.style.position = "";
44+
};
45+
}, [isMobileSidebarOpen]);
46+
3547
return (
3648
<div className={styles.dashboardLayout}>
3749
{!isMobile && <DashboardSideBar />}

src/components/dashboard-side-bar/dashboard-side-bar.module.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
}
2424
.main {
2525
padding: 0 24px;
26-
min-height: 720px;
26+
/* min-height: 720px; */
2727
flex: 1;
2828
display: flex;
2929
flex-direction: column;
3030
}
31+
.main > .mainDashboard {
32+
flex: 1;
33+
}
3134
.dashboardAdd {
3235
width: 100%;
3336
display: flex;
@@ -114,6 +117,8 @@
114117
align-items: center;
115118
justify-content: space-between;
116119
height: 44px;
120+
position: sticky;
121+
bottom: 62px;
117122
}
118123
.dashboardPagenation > button {
119124
display: flex;
@@ -122,7 +127,7 @@
122127
width: 77px;
123128
height: 40px;
124129
}
125-
.dashboardPagenation > button.disabled {
130+
/* .dashboardPagenation > button.disabled {
126131
cursor: not-allowed;
127132
}
128133
.dashboardPagenation > button.disabled > span {
@@ -131,6 +136,12 @@
131136
.dashboardPagenation > button.disabled > img {
132137
filter: invert(48%) sepia(9%) saturate(563%) hue-rotate(213deg)
133138
brightness(94%) contrast(89%);
139+
} */
140+
.dashboardPagenation > button.visible {
141+
visibility: visible;
142+
}
143+
.dashboardPagenation > button.visibleHidden {
144+
visibility: hidden;
134145
}
135146
.dashboardPagenation > button > span {
136147
color: var(--color-gray100);

src/components/dashboard-side-bar/sidebar-page-control.tsx

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,39 @@ export default function SidebarPageControl({
1212
totalPages,
1313
}: SidebarPageControlProps) {
1414
const isLastPage = totalPages;
15-
const prevDisabled = currentPage === 1 ? styles.disabled : "";
16-
const nextDisabled = currentPage === isLastPage ? styles.disabled : "";
15+
const prevDisabled =
16+
currentPage === 1 ? styles.visibleHidden : styles.visible;
17+
const nextDisabled =
18+
currentPage === isLastPage ? styles.visibleHidden : styles.visible;
1719

1820
return (
1921
<div className={styles.dashboardPagenation}>
20-
{!prevDisabled && (
21-
<button
22-
onClick={onPrev}
23-
disabled={currentPage === 0}
24-
className={`${styles.button} ${prevDisabled}`}
25-
>
26-
<Image
27-
src={ArrowLeftIcon}
28-
width={20}
29-
height={20}
30-
alt="이전 버튼 아이콘"
31-
/>
32-
<span className={Typography.lgMedium}>이전</span>
33-
</button>
34-
)}
35-
<div></div>
36-
{!nextDisabled && (
37-
<button
38-
onClick={onNext}
39-
disabled={currentPage === isLastPage}
40-
className={`${styles.button} ${nextDisabled}`}
41-
>
42-
<span className={Typography.lgMedium}>다음</span>
43-
<Image
44-
src={ArrowRightIcon}
45-
width={20}
46-
height={20}
47-
alt="다음 버튼 아이콘"
48-
/>
49-
</button>
50-
)}
22+
<button
23+
onClick={onPrev}
24+
disabled={currentPage === 0}
25+
className={`${styles.button} ${prevDisabled}`}
26+
>
27+
<Image
28+
src={ArrowLeftIcon}
29+
width={20}
30+
height={20}
31+
alt="이전 버튼 아이콘"
32+
/>
33+
<span className={Typography.lgMedium}>이전</span>
34+
</button>
35+
<button
36+
onClick={onNext}
37+
disabled={currentPage === isLastPage}
38+
className={`${styles.button} ${nextDisabled}`}
39+
>
40+
<span className={Typography.lgMedium}>다음</span>
41+
<Image
42+
src={ArrowRightIcon}
43+
width={20}
44+
height={20}
45+
alt="다음 버튼 아이콘"
46+
/>
47+
</button>
5148
</div>
5249
);
5350
}

0 commit comments

Comments
 (0)