Skip to content

Commit

Permalink
fix: 스켈레톤 위치 수정 (#113)
Browse files Browse the repository at this point in the history
Co-authored-by: sᴏʟʙɪ ☔️ <[email protected]>
  • Loading branch information
Leejin-Yang and hae-on authored Apr 23, 2024
1 parent 793bf95 commit 6c46176
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
30 changes: 16 additions & 14 deletions src/components/Product/ProductItem/ProductItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Skeleton } from '@fun-eat/design-system';
import { memo, useState } from 'react';

import { container, previewWrapper, productImage, summaryWrapper } from './productItem.css';
import { container, imageWrapper, previewWrapper, productImage, summaryWrapper } from './productItem.css';

import { SvgIcon, Text } from '@/components/Common';
import { ellipsis } from '@/styles/common.css';
Expand All @@ -18,19 +18,21 @@ const ProductItem = ({ product }: ProductItemProps) => {

return (
<div className={container}>
<img
src={image}
className={productImage}
alt={`${name}사진`}
loading="lazy"
onLoad={() => setIsImageLoading(false)}
/>
{/*스켈레톤 디자인시스템에서 수정*/}
{isImageLoading && (
<div style={{ position: 'absolute', top: 0, left: 0 }}>
<Skeleton width={163} height={163} />
</div>
)}
<div className={imageWrapper}>
<img
src={image}
className={productImage}
alt={`${name}사진`}
loading="lazy"
onLoad={() => setIsImageLoading(false)}
/>
{/*스켈레톤 디자인시스템에서 수정*/}
{isImageLoading && (
<div style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}>
<Skeleton width="100%" height="100%" />
</div>
)}
</div>
<div style={{ height: '8px' }} />
<Text className={ellipsis} size="caption3" weight="semiBold" color="sub">
{name}
Expand Down
5 changes: 5 additions & 0 deletions src/components/Product/ProductItem/productItem.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export const container = style({
position: 'relative',
});

export const imageWrapper = style({
position: 'relative',
width: '100%',
});

export const productImage = style({
width: '100%',
height: 'auto',
Expand Down
6 changes: 5 additions & 1 deletion src/components/Recipe/RecipeItem/RecipeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ const ImageAndFavoriteButton = ({ children }: PropsWithChildren) => {
loading="lazy"
onLoad={() => image && setIsImageLoading(false)}
/>
{isImageLoading && image && <Skeleton width={163} height={200} />}
{isImageLoading && image && (
<div style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }}>
<Skeleton width="100%" height="100%" />
</div>
)}
<div className={favoriteButtonWrapper} onClick={(e) => e.preventDefault()}>
<RecipeFavoriteButton recipeId={id} favorite={favorite} />
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/Recipe/RecipeItem/recipeItem.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { style } from '@vanilla-extract/css';

export const imageWrapper = style({
position: 'relative',
width: '100%',
lineHeight: 0,
});

Expand Down

0 comments on commit 6c46176

Please sign in to comment.