diff --git a/src/components/domains/myPage/layout/SidebarModal.module.scss b/src/components/domains/myPage/layout/SidebarModal.module.scss new file mode 100644 index 0000000..7877e48 --- /dev/null +++ b/src/components/domains/myPage/layout/SidebarModal.module.scss @@ -0,0 +1,3 @@ +.sidebar-modal { + height: 100%; +} diff --git a/src/components/domains/myPage/layout/SidebarModal.tsx b/src/components/domains/myPage/layout/SidebarModal.tsx new file mode 100644 index 0000000..72f9f55 --- /dev/null +++ b/src/components/domains/myPage/layout/SidebarModal.tsx @@ -0,0 +1,27 @@ +import Modal from "@/components/commons/Modal"; +import { sidebarState } from "@/recoil/sidebarAtom"; +import { useRecoilState } from "recoil"; +import { useWindowSize } from "usehooks-ts"; +import Sidebar from "./Sidebar"; + +import classNames from "classnames/bind"; +import styles from "./SidebarModal.module.scss"; + +const cx = classNames.bind(styles); + +const SidebarModal = () => { + const [sidebar, setSidebar] = useRecoilState(sidebarState); + const { width: windowWidth } = useWindowSize(); + const isMobile = windowWidth < 1200; + + if (!isMobile) return null; + + return ( + setSidebar((prev) => !prev)} isSidebar={true}> + + + ); +}; +export default SidebarModal; diff --git a/src/layout/MyPageLayout/index.tsx b/src/layout/MyPageLayout/index.tsx deleted file mode 100644 index d9019cd..0000000 --- a/src/layout/MyPageLayout/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { PropsWithChildren } from "react"; - -import Modal from "@/components/commons/Modal"; -import Sidebar from "@/components/domains/myPage/layout/Sidebar"; -import { sidebarState } from "@/recoil/sidebarAtom"; -import { useRecoilState } from "recoil"; - -import classNames from "classnames/bind"; -import { useWindowSize } from "usehooks-ts"; -import styles from "./MyPageLayout.module.scss"; - -const cx = classNames.bind(styles); - -interface MyPageLayoutProps { - selectedMenu: string; -} - -const MyPageLayout = ({ selectedMenu, children }: PropsWithChildren) => { - const [sidebar, setSidebar] = useRecoilState(sidebarState); - const { width: windowWidth } = useWindowSize(); - const isMobile = windowWidth < 1200; - - return ( -
-

- MYPAGE / {selectedMenu} -

- -
{children}
- - {isMobile && ( - setSidebar((prev) => !prev)} isSidebar={true}> - - - )} -
- ); -}; -export default MyPageLayout; diff --git a/src/layout/MyPageLayout/MyPageLayout.module.scss b/src/layout/MyPageSubLayout/MyPageSubLayout.module.scss similarity index 94% rename from src/layout/MyPageLayout/MyPageLayout.module.scss rename to src/layout/MyPageSubLayout/MyPageSubLayout.module.scss index f62e92c..d73f3b1 100644 --- a/src/layout/MyPageLayout/MyPageLayout.module.scss +++ b/src/layout/MyPageSubLayout/MyPageSubLayout.module.scss @@ -37,10 +37,6 @@ @include responsive("T") { display: none; } - - &--mobile { - height: 100%; - } } &__main { diff --git a/src/layout/MyPageSubLayout/index.tsx b/src/layout/MyPageSubLayout/index.tsx new file mode 100644 index 0000000..231aac4 --- /dev/null +++ b/src/layout/MyPageSubLayout/index.tsx @@ -0,0 +1,30 @@ +import { PropsWithChildren } from "react"; + +import Sidebar from "@/components/domains/myPage/layout/Sidebar"; + +import SidebarModal from "@/components/domains/myPage/layout/SidebarModal"; +import classNames from "classnames/bind"; +import styles from "./MyPageSubLayout.module.scss"; + +const cx = classNames.bind(styles); + +interface MyPageSubLayoutProps { + selectedMenu: string; +} + +const MyPageSubLayout = ({ selectedMenu, children }: PropsWithChildren) => { + return ( +
+

+ MYPAGE / {selectedMenu} +

+ +
{children}
+ + +
+ ); +}; +export default MyPageSubLayout; diff --git a/src/pages/MyPage/MyPage.module.scss b/src/pages/MyPage/MyPage.module.scss index 173fbbe..eb1e7d9 100644 --- a/src/pages/MyPage/MyPage.module.scss +++ b/src/pages/MyPage/MyPage.module.scss @@ -1,17 +1,17 @@ .container { @include column-flexbox(); - gap: 11rem; + gap: 8rem; padding-top: calc(15rem - 4rem); padding-bottom: 20rem; @include responsive("T") { - gap: 8rem; + gap: 4.4rem; padding-top: calc(8rem - 4rem); padding-bottom: 15rem; } @include responsive("M") { - gap: 5rem; + gap: 3rem; padding-top: calc(4rem - 4rem); padding-bottom: 10rem; } @@ -25,7 +25,8 @@ } .menus { - @include flexbox(); + display: grid; + grid-template-columns: repeat(3, 1fr); gap: 6rem; @include responsive("T") { @@ -34,59 +35,105 @@ @include responsive("M") { @include column-flexbox(); + gap: 3rem; } .menu { - @include column-flexbox(); - gap: 4.5rem; - border: 0.1rem solid $gray20; width: 25rem; height: 25rem; - padding-top: 1rem; - background-color: white; - cursor: pointer; @include responsive("T") { - gap: 1.5rem; width: 14rem; height: 14rem; } - &-img { - @include flexbox(); - width: 8rem; - height: 8rem; + @include responsive("M") { + width: 100%; + height: 3rem; + } + + &-btn { + @include column-flexbox(); + gap: 4.5rem; + width: 100%; + height: 100%; + border: 0.1rem solid $gray20; + padding-top: 1rem; + background-color: white; + cursor: pointer; + transition: all 0.2s linear; + + &:hover { + @media (hover: hover) and (pointer: fine) { + background-color: $gray10; + + .menu-btn-img { + transform: scale(1.4); + } + } + } @include responsive("T") { - width: 5rem; - height: 5rem; + gap: 1.5rem; } - } - &-name { - @include text-style(2.4, 500, $black30); + @include responsive("M") { + flex-direction: row; + justify-content: flex-start; + padding-top: 0; + border: none; + &:hover { + background-color: transparent; + } + } - @include responsive("T") { - font-size: 1.6rem; + &-img { + @include flexbox(); + width: 8rem; + height: 8rem; + transition: all 0.2s linear; + + @include responsive("T") { + width: 5rem; + height: 5rem; + } + + @include responsive("M") { + width: 3rem; + height: 3rem; + } } - } - } - li:nth-child(2) { - gap: 3rem; - padding-top: 0; + &-name { + @include text-style(2.4, 500, $black30); - @include responsive("T") { - gap: 0.5rem; + @include responsive("T") { + font-size: 1.6rem; + } + } } - .menu-img { - width: 11rem; - height: 11rem; + li:nth-child(2) { + gap: 3rem; + padding-top: 0; @include responsive("T") { - width: 7rem; - height: 7rem; + gap: 0.5rem; + } + + .menu-img { + width: 11rem; + height: 11rem; + + @include responsive("T") { + width: 7rem; + height: 7rem; + } + + @include responsive("M") { + width: 3rem; + height: 3rem; + } } } } diff --git a/src/pages/MyPage/MyPageSub.tsx b/src/pages/MyPage/MyPageSub.tsx index f21924c..03f4016 100644 --- a/src/pages/MyPage/MyPageSub.tsx +++ b/src/pages/MyPage/MyPageSub.tsx @@ -1,4 +1,4 @@ -import MyPageLayout from "@/layout/MyPageLayout"; +import MyPageLayout from "@/layout/MyPageSubLayout"; import { ReactNode } from "react"; interface MyPageSubProps { diff --git a/src/pages/MyPage/index.tsx b/src/pages/MyPage/index.tsx index 584e196..addf3e6 100644 --- a/src/pages/MyPage/index.tsx +++ b/src/pages/MyPage/index.tsx @@ -1,4 +1,5 @@ import Image from "@/components/commons/Image"; +import SidebarModal from "@/components/domains/myPage/layout/SidebarModal"; import { MYPAGE_MENU_LIST } from "@/constants/mypageMenuList"; import classNames from "classnames/bind"; import { useNavigate } from "react-router-dom"; @@ -14,20 +15,22 @@ const MyPage = () => {

마이페이지

+ + ); };