-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feat/#436-share-link-second-qa
- Loading branch information
Showing
17 changed files
with
238 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { PropsWithChildren, createContext, useContext, useEffect, useMemo, useState } from 'react'; | ||
import { PreviewImageInfo } from '../../types/Onboarding'; | ||
|
||
interface PreviewImageContext { | ||
previewImageInfo: PreviewImageInfo; | ||
updatePreviewImageInfo: (newInfo: Partial<PreviewImageInfo>) => void; | ||
} | ||
|
||
const initialPreviewImageInfo: PreviewImageInfo = { | ||
isImageUploaded: false, | ||
previewImage: '' || null, | ||
imageName: '', | ||
file: null, | ||
}; | ||
|
||
const PreviewImageContext = createContext<PreviewImageContext>({ | ||
previewImageInfo: initialPreviewImageInfo, | ||
updatePreviewImageInfo: () => {}, | ||
}); | ||
|
||
export const usePreviewImageContext = () => useContext(PreviewImageContext); | ||
|
||
export const PreviewImageProvider = ({ children }: PropsWithChildren) => { | ||
const [previewImageInfo, setPreviewImageInfo] = | ||
useState<PreviewImageInfo>(initialPreviewImageInfo); | ||
|
||
const updatePreviewImageInfo = (newInfo: Partial<PreviewImageInfo>) => { | ||
setPreviewImageInfo((prev) => ({ ...prev, ...newInfo })); | ||
}; | ||
|
||
/**@todo 전체 값 확인용 useEffect */ | ||
|
||
useEffect(() => { | ||
console.log(' 컨텍스트 내 previewImageInfo 확인', previewImageInfo); | ||
}, [previewImageInfo]); | ||
|
||
const PreviewImageContextValue = useMemo( | ||
() => ({ | ||
previewImageInfo, | ||
updatePreviewImageInfo, | ||
}), | ||
[previewImageInfo], | ||
); | ||
|
||
return ( | ||
<PreviewImageContext.Provider value={PreviewImageContextValue}> | ||
{children} | ||
</PreviewImageContext.Provider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/**@todo 이미지 최소,최대 height 상의 필요*/ | ||
export const IMAGE_HEIGHT = Object.freeze({ | ||
MAX: 1800, | ||
MIN: 300, | ||
}); | ||
|
||
export const MESSAGE = Object.freeze({ | ||
HEIGHT_SMALL: `이미지 세로길이가 너무 작습니다. ${IMAGE_HEIGHT.MIN}px 이상 이미지를 선택해주세요.`, | ||
HEIGHT_BIG: `이미지 세로길이가 너무 큽니다. ${IMAGE_HEIGHT.MAX}px 이하 이미지를 선택해주세요. `, | ||
UNSELECT_DATE: '날짜를 먼저 선택해주세요.', | ||
}); |
Oops, something went wrong.