Skip to content

Commit

Permalink
Merge pull request #99 from Kusitms-29th-ASAP/feat/#96
Browse files Browse the repository at this point in the history
[Fix] 교육청 상세 보기 수정
  • Loading branch information
yyypearl authored May 23, 2024
2 parents 3112b2c + f0e7506 commit 5245d62
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/app/news/eduOffice/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const EduOffice = () => {
.then((response) => {
const summaryData = response.data.educationOfficeAnnouncementInfos;
setSummaryData(summaryData);
console.log(summaryData);
})
.catch((error) => {});
}, []);
Expand Down Expand Up @@ -72,7 +73,7 @@ const EduOffice = () => {
/>
<HomeGuideRemind />
</Background>
{summaryData && <Summary dummyData={summaryData} />}
{summaryData && <Summary type="eduOffice" dummyData={summaryData} />}
</Layout>
<Tabbar />
</>
Expand Down
2 changes: 1 addition & 1 deletion src/app/news/school/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const School = () => {
/>
<HomeGuideRemind />
</Background>
{summaryData && <Summary dummyData={summaryData} />}
{summaryData && <Summary type="school" dummyData={summaryData} />}
</Layout>
<Tabbar />
</>
Expand Down
9 changes: 8 additions & 1 deletion src/components/news/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ interface AnnouncementsProps {
announcementId?: number;
}

const Summary = ({ dummyData }: { dummyData: AnnouncementsProps[] }) => {
const Summary = ({
type,
dummyData,
}: {
type: string;
dummyData: AnnouncementsProps[];
}) => {
return (
<Container>
<Content>
<Title>가정통신문, 세 문장 요약해드려요</Title>
{dummyData.map((data, index) => (
<SummaryCard
type={type === "school" ? "school" : "eduOffice"}
key={index}
isNew={data.isNew}
category={data.category}
Expand Down
8 changes: 4 additions & 4 deletions src/components/news/SummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const categoryMap: CategoryMap = {

const SummaryCard = (props: AnnouncementsProps) => {
const {
type = "school",
type,
summaryType = "simple",
isNew,
category,
Expand All @@ -54,16 +54,16 @@ const SummaryCard = (props: AnnouncementsProps) => {

const router = useRouter();

const handleCardClick = (announcementId: number) => {
const handleCardClick = (type: string, announcementId: number) => {
router.push(`/news/${type}/${announcementId}`);
};

return (
<StyledCard
className={summaryType}
onClick={
summaryType === "simple" && announcementId
? () => handleCardClick(announcementId)
summaryType === "simple" && type && announcementId
? () => handleCardClick(type, announcementId)
: undefined
}
>
Expand Down

0 comments on commit 5245d62

Please sign in to comment.