Skip to content

Commit

Permalink
⚡️ improve : img -> next/image & fix : 피드 로딩중일 때 북마크 버튼만 보이던 이슈
Browse files Browse the repository at this point in the history
  • Loading branch information
seondal committed Mar 21, 2024
1 parent bae4808 commit 93fcbf9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
23 changes: 21 additions & 2 deletions src/components/Feed/Photo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
'use client';

import Image from 'next/image';
import Link from 'next/link';
import { useState } from 'react';

import BookmarkButton from './BookmarkButton';

Expand All @@ -9,13 +13,28 @@ interface Photo {
}

export default function Photo({ imageKey, source, id }: Photo) {
const [loaded, setLoaded] = useState(false);

return (
<Link href={`detail/${id}`} scroll={false}>
<div className="relative mb-16 inline-block h-fit w-full rounded-8">
{imageKey && (
<>
<img src={imageKey} alt={source || ''} className="rounded-8" />
<BookmarkButton />
<Image
src={imageKey}
alt={source || ''}
layout="responsive"
// placeholder="blur"
// blurDataURL={IMAGE.profile_default}
width={200}
height={0}
style={{
objectFit: 'contain',
borderRadius: 8,
}}
onLoad={() => setLoaded(true)}
/>
{loaded && <BookmarkButton />}
</>
)}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Modal/PoseImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export default function PoseImage({ src, responsive = false, onLoad }: DetailedI
src={src}
alt="상세보기"
layout="responsive"
priority
width={400}
height={400}
height={0}
onLoad={onLoad}
className="cursor-pointer object-contain"
onClick={() => setIsModalShow(true)}
Expand Down

0 comments on commit 93fcbf9

Please sign in to comment.