Skip to content

Commit

Permalink
feat: 썸네일 없을 시 기본이미지 추가 (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssuminii committed Oct 24, 2024
1 parent 0727e03 commit 71e711d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Binary file added src/assets/defaultImage.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useCheckSession from '@/hooks/useCheckSession'
import axios from 'axios'
import { useCoteData } from '@/hooks/useCoteData'
import { formatDate } from '@/utils/formatDate'
import defaultImage from '@/assets/defaultImage.jpeg'

interface Post {
createdAt: string
Expand Down Expand Up @@ -150,7 +151,10 @@ const Home: React.FC = () => {
{studyBoards.map((data) => (
<Link to={`/postDetail/코딩테스트/@${data.username}/${data.title}`} key={data.id}>
<li className="post-list">
<img src={data.thumbnailUrl} alt={data.title} />
<img
src={data.thumbnailUrl !== '' ? data.thumbnailUrl : defaultImage}
alt={data.title}
/>
<div>
<div className="post-info">
<div className="author">{data.username}</div>
Expand Down

0 comments on commit 71e711d

Please sign in to comment.