Skip to content

Commit

Permalink
fix(user): 함수명 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
junghongseop committed Jul 16, 2024
1 parent 5fcb247 commit 18880e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions apps/user/src/components/form/CropImageModal/CropImageModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { flex } from '@maru/utils';
import styled from 'styled-components';
import type { Area } from 'react-easy-crop';
import Cropper from 'react-easy-crop';
import { getCroppedImg } from '@/utils';
import { getCropImg } from '@/utils';

interface Props {
isOpen: boolean;
Expand All @@ -16,25 +16,25 @@ interface Props {

const CropImageModal = ({ isOpen, imageSrc, onClose, onCropComplete }: Props) => {
const [crop, setCrop] = useState({ x: 0, y: 0 });
const [croppedArea, setCroppedArea] = useState<Area | null>(null);
const [cropArea, setCropArea] = useState<Area | null>(null);

const onCropCompleteInternal = useCallback(
(croppedArea: Area, croppedAreaPixels: Area) => {
setCroppedArea(croppedAreaPixels);
(cropArea: Area, croppedAreaPixels: Area) => {
setCropArea(croppedAreaPixels);
},
[]
);

const applyCrop = useCallback(async () => {
if (!croppedArea) return;
const croppedImage = await getCroppedImg(imageSrc, croppedArea, 117, 156);
const handleApplyCrop = useCallback(async () => {
if (!cropArea) return;
const croppedImage = await getCropImg(imageSrc, cropArea, 117, 156);

const response = await fetch(croppedImage as string);
const blob = await response.blob();

onCropComplete(blob);
onClose();
}, [imageSrc, croppedArea, onCropComplete, onClose]);
}, [imageSrc, cropArea, onCropComplete, onClose]);

if (!isOpen) return null;

Expand All @@ -54,7 +54,7 @@ const CropImageModal = ({ isOpen, imageSrc, onClose, onCropComplete }: Props) =>
}}
/>
</CropImageModalStyle>
<Button onClick={applyCrop}>
<Button onClick={handleApplyCrop}>
<Text fontType="btn1" color={color.white}>
사진 자르기 적용
</Text>
Expand Down
2 changes: 1 addition & 1 deletion apps/user/src/utils/cropImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface PixelCrop {
height: number;
}

export const getCroppedImg = async (
export const getCropImg = async (
imageSrc: string,
pixelCrop: PixelCrop,
outputWidth = 117,
Expand Down
2 changes: 1 addition & 1 deletion apps/user/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export { default as updateSlicedSubjectList } from './updateSlicedSubjectList';
export { default as formatApplicationDate } from './formatApplicationDate';
export { default as formatStartDate } from './formatStartDate';
export { formatStatus } from './formatStatus';
export { getCroppedImg } from './cropImage';
export { getCropImg } from './cropImage';

0 comments on commit 18880e1

Please sign in to comment.