Skip to content

Commit

Permalink
refactor: next image placeholder blur처리를 제거하라 (#612)
Browse files Browse the repository at this point in the history
- next image placeholder blur처리 => empty로 변경
  • Loading branch information
saseungmin authored Feb 9, 2023
1 parent 6085218 commit 50db480
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/components/detail/CommentsView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('CommentsView', () => {
(useInfiniteFetchComments as jest.Mock).mockImplementation(() => ({
query: {
data: {
pages: [{ items: [COMMENT_FIXTURE] }],
pages: [{ items: [COMMENT_FIXTURE, { ...COMMENT_FIXTURE, commentId: '2' }] }],
},
isFetchingNextPage: given.isFetchingNextPage,
},
Expand Down Expand Up @@ -56,7 +56,9 @@ describe('CommentsView', () => {
it('클릭 이벤트가 발생해야만 한다', () => {
renderCommentsView();

fireEvent.click(screen.getByText('삭제'));
screen.getAllByText('삭제').forEach((removeButton) => {
fireEvent.click(removeButton);
});

expect(handleRemove).toHaveBeenCalledWith({
commentId: COMMENT_FIXTURE.commentId, groupId: COMMENT_FIXTURE.groupId,
Expand Down
1 change: 1 addition & 0 deletions src/components/home/RecruitPost.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('RecruitPost', () => {
const renderRecruitPost = () => render((
<RecruitPost
group={given.group}
isPriority={false}
/>
));

Expand Down
10 changes: 6 additions & 4 deletions src/components/home/RecruitPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ import Divider from '@/styles/Divider';
import { body2Font, h4Font, subtitle1Font } from '@/styles/fontStyles';
import { mq2 } from '@/styles/responsive';
import { removeAllHtml } from '@/utils/filter';
import { shimmer, toBase64 } from '@/utils/imageBlur';
import { emptyAThenB } from '@/utils/utils';

import ProfileImage from '../common/ProfileImage';

interface Props {
group: Group;
isPriority: boolean;
}

function RecruitPost({ group }: Props, ref: ForwardedRef<HTMLDivElement>): ReactElement {
function RecruitPost({
group, isPriority,
}: Props, ref: ForwardedRef<HTMLDivElement>): ReactElement {
const {
title, content, groupId, writer, views, shortDescription, thumbnail,
} = group;
Expand All @@ -40,9 +42,9 @@ function RecruitPost({ group }: Props, ref: ForwardedRef<HTMLDivElement>): React
<ThumbnailWrapper>
<Thumbnail
fill
placeholder="blur"
priority={isPriority}
placeholder="empty"
src={thumbnail}
blurDataURL={`data:image/svg+xml;base64,${toBase64(shimmer(100, 100))}`}
alt="thumbnail"
sizes="(max-width: 650px) 100vw,
(max-width: 850px) 50vw,
Expand Down
1 change: 1 addition & 0 deletions src/components/home/RecruitPosts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function RecruitPosts({ onClickEmptyButton }: Props): ReactElement {
<RecruitPost
key={group.groupId}
group={group}
isPriority={index <= 4}
ref={targetFalseThenValue(!isLastItem)(refState.lastItemRef)}
/>
);
Expand Down
4 changes: 1 addition & 3 deletions src/components/myInfo/MyGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
} from '@/styles/fontStyles';
import mq, { mobileMediaQuery } from '@/styles/responsive';
import { removeAllHtml } from '@/utils/filter';
import { shimmer, toBase64 } from '@/utils/imageBlur';

interface Props {
group: Group;
Expand Down Expand Up @@ -73,8 +72,7 @@ function MyGroup({ group }: Props, ref: ForwardedRef<HTMLAnchorElement>): ReactE
fill
src={thumbnail}
alt="thumbnail"
placeholder="blur"
blurDataURL={`data:image/svg+xml;base64,${toBase64(shimmer(100, 100))}`}
placeholder="empty"
sizes="(max-width: 500px) 100vw, 33vw"
/>
</ThumbnailWrapper>
Expand Down
4 changes: 1 addition & 3 deletions src/components/write/ThumbnailUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import useUploadStorageFile from '@/hooks/api/storage/useUploadStorageFile';
import { writeFieldsState } from '@/recoil/group/atom';
import { body2Font, subtitle1Font } from '@/styles/fontStyles';
import mq from '@/styles/responsive';
import { shimmer, toBase64 } from '@/utils/imageBlur';
import { isEmpty, stringToExcludeNull } from '@/utils/utils';

import CloseSvg from '../../assets/icons/close.svg';
Expand Down Expand Up @@ -132,8 +131,7 @@ function ThumbnailUpload(): ReactElement {
<ThumbnailImage
fill
src={stringToExcludeNull(image.dataURL)}
placeholder="blur"
blurDataURL={`data:image/svg+xml;base64,${toBase64(shimmer(100, 100))}`}
placeholder="empty"
alt="thumbnail"
sizes="(max-width: 500px) 100vw, 50vw"
/>
Expand Down

1 comment on commit 50db480

@vercel
Copy link

@vercel vercel bot commented on 50db480 Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.