Skip to content

Commit

Permalink
✨ feat : 상세페이지 이미지 로딩중일 때 스켈레톤 보여주기
Browse files Browse the repository at this point in the history
  • Loading branch information
seondal committed Apr 13, 2024
1 parent 67145d9 commit cf1794a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/(Sub)/detail/[id]/DetailSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { usePathname } from 'next/navigation';
import { useState } from 'react';

import Source from './Source';
import TagButton from './TagButton';
Expand All @@ -23,6 +24,8 @@ export default function DetailSection({ poseId }: DetailSectionProps) {
const { open } = useOverlay();
const pathname = usePathname();

const [isRendered, setIsRendered] = useState(false);

if (!data) return null;
const { imageKey, tagAttributes, source, sourceUrl, peopleCount, frameCount } = data.poseInfo;

Expand All @@ -39,7 +42,8 @@ export default function DetailSection({ poseId }: DetailSectionProps) {
<div className="overflow-y-auto">
{source && <Source source={source} url={sourceUrl} />}
<div className="block">
<PoseImage src={imageKey} responsive={true} />
{isRendered || <div className="h-400 w-screen bg-sub-white" />}
<PoseImage src={imageKey} responsive={true} onLoad={() => setIsRendered(true)} />
</div>
<div className="flex flex-wrap gap-10 px-20 py-12">
<TagButton type="people" value={peopleCount} name={`${peopleCount}인`} />
Expand Down

0 comments on commit cf1794a

Please sign in to comment.