Skip to content

Commit

Permalink
refactor: 이미지에 대해 loading lazy 속성 추가 (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
D0Dam committed Jul 29, 2023
1 parent e1b1f3c commit 7a3cf54
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frontend/src/components/RestaurantCard/RestaurantCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { styled } from 'styled-components';
import { BORDER_RADIUS, FONT_SIZE, truncateText } from '~/styles/common';
import { BORDER_RADIUS, FONT_SIZE, paintSkeleton, truncateText } from '~/styles/common';
import ProfileImage from '../@common/ProfileImage';
import { Restaurant } from '~/@types/restaurant.types';
import { Celeb } from '~/@types/celeb.types';
Expand All @@ -9,7 +9,7 @@ interface RestaurantCardProps {
celebs?: Celeb[];
size?: number;
type?: 'list' | 'map';
onClick: React.MouseEventHandler;
onClick?: React.MouseEventHandler;
}

function RestaurantCard({ restaurant, celebs, size, type = 'list', onClick }: RestaurantCardProps) {
Expand All @@ -21,6 +21,7 @@ function RestaurantCard({ restaurant, celebs, size, type = 'list', onClick }: Re
alt={`${name} 대표 이미지`}
src={`http://3.35.157.27:3000/images-data/${images[0].name}`}
type={type}
loading="lazy"
/>
<section>
<StyledInfo>
Expand Down Expand Up @@ -57,6 +58,7 @@ const StyledContainer = styled.div`
`;

const StyledImage = styled.img<{ type: 'list' | 'map' }>`
${paintSkeleton}
width: 100%;
aspect-ratio: 1.05 / 1;
Expand Down

0 comments on commit 7a3cf54

Please sign in to comment.