Skip to content

Commit

Permalink
feat(Card/AnnounceCard): 채용 공지를 보여주기 위해 일부 값 수정
Browse files Browse the repository at this point in the history
채용 공지는 다른 공지와는 다르게 공지 업로드 날짜가 아닌 채용 기간을 보여주기로 결정했기에 날짜에 대한 변수값이 달라요
그렇기에 해당 변수명도 props 로 받아 보여질 수 있도록 하였고 채용 공지의 경우 작성자가 보이지 않도록 했어요
  • Loading branch information
pp449 committed Jan 5, 2024
1 parent 913f8f9 commit efaaf43
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/Card/AnnounceCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,36 @@ import openLink from '@utils/router/openLink';

interface AnnounceCardProps extends AnnounceItem {
author?: string;
recruitment_period?: string;
}

const AnnounceCard = ({
title,
link,
uploadDate,
recruitment_period,
author,
}: AnnounceCardProps) => {
const { major } = useMajor();

uploadDate = uploadDate.slice(2);
const showDate = () => {
if (recruitment_period) return recruitment_period;
uploadDate = uploadDate.slice(2);
return `20${uploadDate}`;
};

return (
<Card onClick={() => openLink(link)} data-testid="card">
<ContentContainer>
<AnnounceTitle>{title}</AnnounceTitle>
<SubContent>
<AnnounceDate>20{uploadDate}</AnnounceDate>
<VertialBoundaryLine />
<Source>{author ? author : major}</Source>
<AnnounceDate>{showDate()}</AnnounceDate>
{!recruitment_period && (
<>
<VertialBoundaryLine />
<Source>{author ? author : major}</Source>
</>
)}
</SubContent>
</ContentContainer>
<HorizonBoundaryLine />
Expand Down

0 comments on commit efaaf43

Please sign in to comment.