Skip to content

Commit

Permalink
Merge pull request #188 from ssu-student-union/feat/#148_jongse_qa_3
Browse files Browse the repository at this point in the history
Feat/#148 jongse qa 3
  • Loading branch information
jongse7 authored Oct 9, 2024
2 parents d151e3b + dd67415 commit e694d17
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 63 deletions.
69 changes: 45 additions & 24 deletions src/pages/main/containers/LostArticleSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}) => (
<PostCardMissing
key={postId}
title={title}
subtitle={subtitle}
imgUrl={imgUrl ? imgUrl : `image/default/thumbnail/default_thumbnail.png`}
date={formatYYYYMMDDHHMM(date)}
onClick={() => navigate(`/lost-article/${postId}`, { state: { postId } })}
/>
);

return (
<section>
<div className="flex items-center">
Expand All @@ -33,59 +57,56 @@ const LostArticleSection = () => {
/>
</div>
<Spacing size={18} direction="vertical" />

{/* xs */}
{width < 390 ? (
{width < 390 && (
<div className="flex w-[calc(100dvw-3.125rem)] gap-[1.063rem] overflow-x-scroll pr-[1.063rem] scrollbar-hide">
{data?.data.postListResDto.map((item) => (
<PostCardMissing
<PostCardWrapper
key={item.postId}
size={Size.view}
postId={item.postId}
title={item.title}
subtitle={item.content}
imgUrl={item.thumbNail}
date={formatYYYYMMDDHHMM(item.date)}
onClick={() => navigate(`/lost-article/${item.postId}`, { state: { postId: item.postId } })}
></PostCardMissing>
date={item.date}
/>
))}
</div>
) : null}
)}

{/* sm, md */}
{width < 1080 && width >= 390 ? (
{width >= 390 && width < 1080 && (
<div className="flex w-[calc(100dvw-3.125rem)] gap-[1.063rem] overflow-x-scroll pr-[1.063rem] scrollbar-hide">
{data?.data.postListResDto.map((item) => (
<PostCardMissing
<PostCardWrapper
key={item.postId}
postId={item.postId}
title={item.title}
subtitle={item.content}
imgUrl={item.thumbNail}
date={formatYYYYMMDDHHMM(item.date)}
onClick={() => navigate(`/lost-article/${item.postId}`, { state: { postId: item.postId } })}
></PostCardMissing>
date={item.date}
/>
))}
</div>
) : null}
)}

{/* xxl, xl, lg */}
{width >= 1080 ? (
{width >= 1080 && (
<div className="flex w-[calc(100dvw-3.125rem)] gap-[1.063rem] overflow-x-scroll pr-[1.063rem] scrollbar-hide">
{data?.data.postListResDto.map((item) => (
<PostCardMissing
<PostCardWrapper
key={item.postId}
postId={item.postId}
title={item.title}
subtitle={item.content}
imgUrl={item.thumbNail}
date={formatYYYYMMDDHHMM(item.date)}
onClick={() => navigate(`/lost-article/${item.postId}`, { state: { postId: item.postId } })}
></PostCardMissing>
date={item.date}
/>
))}
</div>
) : null}
)}
</section>
);
// function EmptyPost() {
// return (
// <p className="flex h-[24.25rem] w-full items-center justify-center text-gray-600">등록된 게시물이 없습니다.</p>
// );
// }
};

export default LostArticleSection;
36 changes: 0 additions & 36 deletions src/pages/main/layout/headerLayout.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/pages/main/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export function MainPage() {
</div>
</main>
<Spacing size={202} direction="vertical" />
<Footer />
</>
);
}
4 changes: 2 additions & 2 deletions src/pages/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ import { NoticeEditPage } from './notice/noticeEdit/page';
import { NoticeDetailPage } from './notice/noticeDetail/page';
import NoticePatchPage from './notice/noticePatch/page';
import { AuditPatchPage } from './audit/auditPatch/page';
import { HeaderLayout } from './main/layout/headerLayout';
import { LostArticlePage } from './lost-article/page';
import { LostArticleEditPage } from './lost-article/edit/page';
import CampusPage from './campus/page';
import { LostDetailPage } from './lost-article/detail/page';
import { LostPatchPage } from './lost-article/patch/page';
import PersonalDataPage from './personal-data/page';
import { Layout } from './layout/headerLayout';

export function MainRouter() {
return (
<Routes>
<Route path="/" element={<HeaderLayout />}>
<Route path="/" element={<Layout />}>
<Route path="/" element={<MainPage />} />
{/*소개*/}
<Route path="/intro" element={<IntroPage />} />
Expand Down

0 comments on commit e694d17

Please sign in to comment.