Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

대시보드 페이지 반응형 구현 (issue #705) #708

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ export const Image = styled.img`
export const Container = styled.div`
width: 67.4rem;
height: 100%;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
width: 100%;
}
Comment on lines +33 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mediaQueries를 사용하면 breakpoint 관리가 더 쉬워질 것 같은데 어떠실까요?

`;

export const DiscussionWrapper = styled(Link)`
Expand All @@ -41,6 +48,15 @@ export const DiscussionWrapper = styled(Link)`
margin-top: 3rem;
margin-bottom: 1.5rem;
cursor: pointer;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
display: flex;
flex-direction: column;
height: 15rem;
}
`;

export const CommentCountWrapper = styled.div`
Expand All @@ -54,6 +70,13 @@ export const ImageCommentWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
justify-content: end;
}
`;

export const TextWrapper = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function DashBoardDiscussionList() {
hasNextGroup,
} = usePagination();

const { discussionList } = useDashboardDiscussion({
const { discussionList, totalPage } = useDashboardDiscussion({
page: currentPage,
onPageInfoUpdate: (totalPagesFromServer) => {
setTotalPages(totalPagesFromServer);
Expand Down Expand Up @@ -47,7 +47,7 @@ export default function DashBoardDiscussionList() {
</S.Container>
)}

{discussionList.length > 0 && (
{totalPage > 0 && (
<PageButtons
goToNextGroup={goToNextGroup}
goToPage={goToPage}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/DashBoard/DiscussionComment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function DiscussionCommentList() {
hasPreviousGroup,
hasNextGroup,
} = usePagination();
const { discussionCommentList } = useDashboardDiscussionComment({
const { discussionCommentList, totalPage } = useDashboardDiscussionComment({
page: currentPage,
onPageInfoUpdate: (totalPagesFromServer) => {
setTotalPages(totalPagesFromServer);
Expand Down Expand Up @@ -45,7 +45,7 @@ export default function DiscussionCommentList() {
</S.Container>
)}

{discussionCommentList.length > 0 && (
{totalPage > 0 && (
<PageButtons
goToNextGroup={goToNextGroup}
goToPage={goToPage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function MyCommentList() {
hasPreviousGroup,
hasNextGroup,
} = usePagination();
const { myComments } = useMyComments({
const { myComments, totalPage } = useMyComments({
page: currentPage,
onPageInfoUpdate: (totalPagesFromServer) => {
setTotalPages(totalPagesFromServer);
Expand Down Expand Up @@ -45,7 +45,7 @@ export default function MyCommentList() {
</S.Container>
)}

{myComments.length > 0 && (
{totalPage > 0 && (
<PageButtons
goToNextGroup={goToNextGroup}
goToPage={goToPage}
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/components/DashBoard/MyComments/MyComments.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { Link } from 'react-router-dom';
export const Container = styled.div`
width: 67.4rem;
height: 100%;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
width: 100%;
}
`;

export const CommentWrapper = styled(Link)`
Expand All @@ -29,6 +36,14 @@ export const TextWrapper = styled.div`
display: flex;
flex-direction: column;
min-width: 54rem;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
width: 28rem;
min-width: 0;
}
`;

export const CommentText = styled.span`
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/Mission/Mission.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ export const MissionListContainer = styled.ul`
margin-bottom: 10rem;
padding-top: 3rem;
width: 100%;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
grid-template-columns: repeat(1, 1fr);
padding: 1.6rem;
}
`;

export const MissionItemContainer = styled.article`
Expand All @@ -17,6 +25,7 @@ export const MissionItemContainer = styled.article`
border-radius: 1rem;
border: 1px solid ${(props) => props.theme.colors.grey200};
cursor: pointer;
margin: 0 auto;
`;

export const MissionThumbnailImg = styled.img`
Expand Down
66 changes: 33 additions & 33 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,40 +283,40 @@ export const router = createBrowserRouter(routes, {
basename: ROUTES.main,
});

// async function enableMocking() {
// if (process.env.NODE_ENV !== 'development') {
// return;
// }
async function enableMocking() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msw 모킹이 되어있어서 주석처리해주시면 될 것 같아요!!

if (process.env.NODE_ENV !== 'development') {
return;
}

// const { worker } = await import('./mocks/browser');
const { worker } = await import('./mocks/browser');

// // `worker.start()` returns a Promise that resolves
// // once the Service Worker is up and ready to intercept requests.
// return worker.start();
// }
// `worker.start()` returns a Promise that resolves
// once the Service Worker is up and ready to intercept requests.
return worker.start();
}

// enableMocking().then(() => {
// root.render(
// <React.StrictMode>
// <QueryClientProvider client={queryClient}>
// <ThemeProvider theme={theme}>
// <ReactQueryDevtools initialIsOpen={false} />
// <GlobalStyle />
// <RouterProvider router={router} />
// </ThemeProvider>
// </QueryClientProvider>
// </React.StrictMode>,
// );
// });
enableMocking().then(() => {
root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={theme}>
<ReactQueryDevtools initialIsOpen={false} />
<GlobalStyle />
<RouterProvider router={router} />
</ThemeProvider>
</QueryClientProvider>
</React.StrictMode>,
);
});

root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<ReactQueryDevtools />
<ThemeProvider theme={theme}>
<GlobalStyle />
<RouterProvider router={router} />
</ThemeProvider>
</QueryClientProvider>
</React.StrictMode>,
);
// root.render(
// <React.StrictMode>
// <QueryClientProvider client={queryClient}>
// <ReactQueryDevtools />
// <ThemeProvider theme={theme}>
// <GlobalStyle />
// <RouterProvider router={router} />
// </ThemeProvider>
// </QueryClientProvider>
// </React.StrictMode>,
// );
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ export const Container = styled.div`
margin-bottom: 10rem;
padding: 3.5rem 0;
width: 100rem;

@media (max-width: 1024px) {
width: 80rem;
padding: 3rem 0;
gap: 3rem;
}

@media (max-width: 768px) {
width: 90%;
padding: 2.5rem 0;
gap: 2rem;
flex-direction: column;
}
`;

export const ContentWrapper = styled.div`
Expand All @@ -18,13 +31,28 @@ export const ProfileAndCurrentPathWrapper = styled.div`
flex-direction: column;
min-width: 28rem;
padding: 3rem;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
display: flex;
flex-direction: column;
}
`;

export const ProfileWrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 5rem;

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
justify-content: center;
}
`;

export const ProfileImageWrapper = styled.div`
Expand Down Expand Up @@ -52,6 +80,15 @@ export const PathWrapper = styled.div`
flex-direction: column;
padding: 5rem 3.5rem;
border-top: 1px solid ${(props) => props.theme.colors.grey200};

@media (max-width: 1024px) {
}

@media (max-width: 768px) {
border: none;
margin: 0 auto;
padding: 0;
}
`;

export const LinkWrapper = styled.div`
Expand Down
Loading