diff --git a/src/pages/main/containers/LostArticleSection.tsx b/src/pages/main/containers/LostArticleSection.tsx index d38125fc..b4490af2 100644 --- a/src/pages/main/containers/LostArticleSection.tsx +++ b/src/pages/main/containers/LostArticleSection.tsx @@ -18,6 +18,30 @@ const LostArticleSection = () => { const navigate = useNavigate(); + // PostCard 컴포넌트화 + const PostCardWrapper = ({ + postId, + title, + subtitle, + imgUrl, + date, + }: { + postId: number; + title: string; + subtitle: string; + imgUrl: string; + date: string; + }) => ( + navigate(`/lost-article/${postId}`, { state: { postId } })} + /> + ); + return (
@@ -33,59 +57,56 @@ const LostArticleSection = () => { />
+ {/* xs */} - {width < 390 ? ( + {width < 390 && (
{data?.data.postListResDto.map((item) => ( - navigate(`/lost-article/${item.postId}`, { state: { postId: item.postId } })} - > + date={item.date} + /> ))}
- ) : null} + )} + {/* sm, md */} - {width < 1080 && width >= 390 ? ( + {width >= 390 && width < 1080 && (
{data?.data.postListResDto.map((item) => ( - navigate(`/lost-article/${item.postId}`, { state: { postId: item.postId } })} - > + date={item.date} + /> ))}
- ) : null} + )} + {/* xxl, xl, lg */} - {width >= 1080 ? ( + {width >= 1080 && (
{data?.data.postListResDto.map((item) => ( - navigate(`/lost-article/${item.postId}`, { state: { postId: item.postId } })} - > + date={item.date} + /> ))}
- ) : null} + )}
); - // function EmptyPost() { - // return ( - //

등록된 게시물이 없습니다.

- // ); - // } }; export default LostArticleSection; diff --git a/src/pages/main/layout/headerLayout.tsx b/src/pages/main/layout/headerLayout.tsx deleted file mode 100644 index aed11713..00000000 --- a/src/pages/main/layout/headerLayout.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useEffect } from 'react'; -import { Outlet, useNavigate } from 'react-router-dom'; -import { Header } from '@/containers/common/Header/Header'; -import { State } from '@/containers/common/Header/const/state'; -import { useRecoilValue, useSetRecoilState } from 'recoil'; -import { LoginState } from '@/recoil/atoms/atom'; - -export function HeaderLayout() { - const loginState = useRecoilValue(LoginState); - const setLoginState = useSetRecoilState(LoginState); - const navigate = useNavigate(); - - useEffect(() => { - const token = localStorage.getItem('accessToken'); - if (token) { - setLoginState(true); - } else { - setLoginState(false); - } - }, [setLoginState]); - - const handleLogout = () => { - localStorage.clear(); - setLoginState(false); - navigate('/'); - }; - - return ( - <> -
-
- -
- - ); -} diff --git a/src/pages/main/page.tsx b/src/pages/main/page.tsx index e22a9507..8222cc39 100644 --- a/src/pages/main/page.tsx +++ b/src/pages/main/page.tsx @@ -27,7 +27,6 @@ export function MainPage() { -