-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐ค Refactor(#117): type ์ง์ ๋ฐ ๋ถํ์ํ ๋ก์ง ์ ๊ฑฐ
- Loading branch information
1 parent
bf413db
commit f18e4c6
Showing
2 changed files
with
72 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,61 @@ | ||
import Image from "next/image"; | ||
import Tag from "@component/components/common-components/tag/Tag"; | ||
import { useRouter } from "next/navigation"; | ||
import { TagProps } from "@component/components/common-components/tag"; | ||
|
||
const RecommendItem = ({ | ||
projectId, | ||
fields, | ||
progress, | ||
title, | ||
content, | ||
profileImg, | ||
nickname, | ||
createdAt, | ||
isLoading | ||
}: any) => { | ||
const router = useRouter(); | ||
return ( | ||
<> | ||
{isLoading ? ( | ||
<div className="w-[344px] h-[340px] rounded-[10px] border border-[1.5px] border-purple-main1 bg-purple-main5 flex justify-center items-center cursor-pointer"> | ||
</div> | ||
) : ( | ||
<div | ||
className="w-[344px] h-[340px] rounded-[10px] border border-[1.5px] border-purple-main1 bg-purple-main5 flex justify-center items-center cursor-pointer" | ||
onClick={() => { | ||
router.push(`/project/${projectId}`) | ||
}} | ||
> | ||
<div className="w-[261px] h-[296.93px] relative"> | ||
<Tag type={fields} status={progress} /> | ||
<div className="text-title mt-[12px] mb-[24px]">{title}</div> | ||
<div className="text-body1 text-gray-60 font-medium">{content}</div> | ||
<div className="absolute bottom-0 flex items-center"> | ||
<Image src={profileImg} alt="์์ ํ๋กํ ์ด๋ฏธ์ง" width={20} height={20} className="w-[20px] h-[20px] rounded-full me-[10px]" /> | ||
<div className="text-body1 text-gray-60 me-[24px] font-medium">{nickname}</div> | ||
<div className="text-body1 text-gray-60 font-medium">{createdAt}</div> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
</> | ||
); | ||
interface RecommendItemData { | ||
projectId: number; | ||
fields: TagProps["type"]; | ||
progress: TagProps["status"]; | ||
title: string; | ||
content: string; | ||
profileImg: string; | ||
nickname: string; | ||
createdAt: string; | ||
} | ||
|
||
const RecommendItem = ({ | ||
projectId, | ||
fields, | ||
progress, | ||
title, | ||
content, | ||
profileImg, | ||
nickname, | ||
createdAt, | ||
}: RecommendItemData) => { | ||
const router = useRouter(); | ||
return ( | ||
<> | ||
<div | ||
className="w-[344px] h-[340px] rounded-[10px] border border-[1.5px] border-purple-main1 bg-purple-main5 flex justify-center items-center cursor-pointer" | ||
onClick={() => { | ||
router.push(`/project/${projectId}`); | ||
}} | ||
> | ||
<div className="w-[261px] h-[296.93px] relative"> | ||
<Tag type={fields} status={progress} /> | ||
<div className="text-title mt-[12px] mb-[24px]">{title}</div> | ||
<div className="text-body1 text-gray-60 font-medium">{content}</div> | ||
<div className="absolute bottom-0 flex items-center"> | ||
<Image | ||
src={profileImg} | ||
alt="์์ ํ๋กํ ์ด๋ฏธ์ง" | ||
width={20} | ||
height={20} | ||
className="w-[20px] h-[20px] rounded-full me-[10px]" | ||
/> | ||
<div className="text-body1 text-gray-60 me-[24px] font-medium"> | ||
{nickname} | ||
</div> | ||
<div className="text-body1 text-gray-60 font-medium"> | ||
{createdAt} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default RecommendItem; |