Skip to content

feat(web): utilize image dimensions for CLS prevention across components #141

@thxforall

Description

@thxforall

Summary

#131에서 posts/item 테이블에 image_width/image_height가 추가되었으나, 프론트엔드 대부분의 컴포넌트가 아직 하드코딩된 크기를 사용 중. DB dimension을 활용하여 CLS(Cumulative Layout Shift)를 개선해야 함.

Components to Update

  • ItemImage.tsx — 고정 aspect ratio (1/1, 3/4) → DB dimension 기반 동적 비율
  • MasonryGridItem.tsxitem.aspectRatioimage_width/image_height 활용
  • GallerySection.tsx — 하드코딩 h-[140px] md:h-[400px] → 동적 높이
  • RelatedLooksSection.tsx — 하드코딩 h-[200px], h-[140px] → 동적 높이
  • DecodedItemsSection.tsx — 하드코딩 64x64, 140x180 → 실제 썸네일 크기
  • FeedCard.tsx — 하드코딩 aspect-[3/4] → DB dimension 활용
  • SavedGrid.tsx — 하드코딩 aspect-[3/4] → DB dimension 활용

Already Working

  • ImageCard.tsx — posts dimension 사용 중 ✅
  • ImageCanvas.tsx — naturalWidth/Height onLoad 사용 중 ✅
  • posts/[id]/page.tsx — OG meta에 dimension 사용 중 ✅

Notes

  • useImageDimensions 훅이 이미 존재하지만 미사용 상태 — 활용 검토
  • item dimension은 PRD backfill 완료 후 사용 가능

Related

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions