Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/pages/RollingPaperList/RollingPaperListPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import CreateAtCardList from "../../components/domain/rollingpaper/Card/CreateAt
import styled from "styled-components";
import PopularCardList from "../../components/domain/rollingpaper/Card/PopularCardList";
import Button from "../../components/common/Button/Button";
import { useEffect, useState, useCallback } from "react";

// Container 스타일 수정
const Container = styled.div`
Expand Down Expand Up @@ -76,6 +77,7 @@ const ButtonWrapper = styled.div`
margin-top: 20px;
display: flex;
justify-content: center;
width: 100%;

@media (max-width: 1199px) {
margin-top: 15px;
Expand All @@ -86,6 +88,10 @@ const ButtonWrapper = styled.div`
}
`;

const StyledButton = styled(Button)`
width: ${({ isTablet }) => (isTablet ? "100%" : "280px")};
`

// StyledCardList 수정 (카드 리스트가 오른쪽에서 사라지도록 설정)
const StyledCardList = styled.div`
display: flex;
Expand All @@ -108,6 +114,19 @@ const StyledCardList = styled.div`

function RollingPaperListPage() {
const navigate = useNavigate();
const [isTablet, setIsTablet] = useState(window.innerWidth <= 1199);

const handleResize = useCallback(() => {
setIsTablet(window.innerWidth <= 1199);
}, []);

useEffect(() => {
handleResize();
window.addEventListener("resize", handleResize);
return () => {
window.removeEventListener("resize", handleResize);
};
}, [handleResize]);

return (
<Container>
Expand All @@ -133,14 +152,14 @@ function RollingPaperListPage() {
</StyledCardList>

<ButtonWrapper>
<Button
<StyledButton
variant="primary"
size="56"
width="280"
width={isTablet ? "100%" : 280}
onClick={() => navigate(`/post`)}
>
나도 만들어보기
</Button>
</StyledButton>
</ButtonWrapper>
</PageWrapper>
</Container>
Expand Down
Loading