Skip to content

Commit

Permalink
feat: 최신이슈 각 탭별 기본 이미지
Browse files Browse the repository at this point in the history
  • Loading branch information
jiohjung98 committed Oct 9, 2024
1 parent 0076498 commit c6ac80e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
Binary file added public/images/home/default-art.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/home/default-contents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/home/default-cow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/home/default-entertainment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/home/default-real-estate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions src/components/recentlyIssue/CategoryNewsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@ import Link from 'next/link';
import React from 'react';

const CategoryNewsItem = ({ id, title, category, link, date, imgUrl }: IssueListItem) => {

const defaultImages: { [key: string]: string } = {
'building': '/images/home/default-real-estate.png',
'music': '/images/home/default-entertainment.png',
'cow': '/images/home/default-cow.png',
'art': '/images/home/default-art.png',
'content': '/images/home/default-contents.png',
};

const imageSrc = (!imgUrl || imgUrl === "No image" || imgUrl === "null") ? defaultImages[category] : imgUrl;

return (
<Link href={link} target="_blank">
<div className="mt-5 pb-5 border-b border-gray100 flex gap-5 items-center cursor-pointer">
<div>
<img
src={imgUrl}
src={imageSrc}
alt="img"
className="w-[132px] h-[93px] rounded-[12px]"
/>
Expand All @@ -22,7 +33,6 @@ const CategoryNewsItem = ({ id, title, category, link, date, imgUrl }: IssueList
{formatCategory(category)}
</div>
<div className="text-caption3 sm:text-body7 text-gray300">
{' '}
{format(parseISO(date), 'yyyy.MM.dd')}
</div>
</div>
Expand All @@ -32,4 +42,4 @@ const CategoryNewsItem = ({ id, title, category, link, date, imgUrl }: IssueList
);
};

export default CategoryNewsItem;
export default CategoryNewsItem;

0 comments on commit c6ac80e

Please sign in to comment.