-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
556543b
commit c38ac2a
Showing
14 changed files
with
167 additions
and
64 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,58 @@ | ||
import { COLOR } from 'constants/Color'; | ||
import { SHADOW } from 'constants/Shadow'; | ||
import styled from 'styled-components'; | ||
|
||
export const Backdrop = styled.div` | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100vh; | ||
z-index: 100; | ||
background-color: rgba(0, 0, 0, 0.4); | ||
`; | ||
|
||
export const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
position: fixed; | ||
top: 50%; | ||
left: 50%; | ||
z-index: 100; | ||
width: 58rem; | ||
height: 57rem; | ||
border-radius: 3.2rem; | ||
background-color: ${COLOR.WHITE}; | ||
transform: translate(-50%, -50%); | ||
animation: showModal 0.25s ease-in-out; | ||
@keyframes showModal { | ||
0% { | ||
transform: translate(-50%, -50%) scale(0.8); | ||
opacity: 0; | ||
} | ||
100% { | ||
transform: translate(-50%, -50%) scale(1); | ||
opacity: 1; | ||
} | ||
} | ||
`; | ||
|
||
export const XButton = styled.span` | ||
position: absolute; | ||
top: 2.5rem; | ||
right: 2.5rem; | ||
cursor: pointer; | ||
`; | ||
export const PreviewImage = styled.img` | ||
max-width: 100%; | ||
max-height: 200px; | ||
margin-top: 0.5rem; | ||
margin-bottom: 1.5rem; | ||
`; | ||
|
||
export const FileInput = styled.input` | ||
/* display: none; */ | ||
`; |
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,11 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { getWorkbookimage } from 'api/workbook'; | ||
|
||
const useGetWorkbookImg = () => { | ||
const { data: workbookImgList } = useQuery(['workbookimgList'], () => | ||
getWorkbookimage(), | ||
); | ||
return workbookImgList; | ||
}; | ||
|
||
export default useGetWorkbookImg; |
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 |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import { useMutation, useQueryClient } from '@tanstack/react-query'; | ||
import { updateWorkbook } from 'api/workbook'; | ||
import { updateWorkbook, uploadimageWorkbook } from 'api/workbook'; | ||
|
||
interface UpdateWorkbookProps { | ||
handleIsLoading: (isLoading: boolean) => void; | ||
handleIsActive: (isActive: boolean) => void; | ||
interface UploadImgWorkbookProps { | ||
handleIsModal: (isModalOpen: boolean) => void; | ||
} | ||
|
||
export const useUploadWorkbook = ({ | ||
handleIsLoading, | ||
handleIsActive, | ||
}: UpdateWorkbookProps) => { | ||
export const useUploadImgWorkbook = ({ | ||
handleIsModal, | ||
}: UploadImgWorkbookProps) => { | ||
const queryClient = useQueryClient(); | ||
const { mutate: UpdateWorkbook } = useMutation(updateWorkbook, { | ||
const { mutate: useUploadImgWorkbook } = useMutation(uploadimageWorkbook, { | ||
onSuccess: () => { | ||
alert('문제집 정보 수정에 성공했습니다.'); | ||
queryClient.invalidateQueries(['workbook']); | ||
queryClient.invalidateQueries(['workbookimage']); | ||
|
||
alert('이미지 저장에 성공했습니다.'); | ||
}, | ||
onError: () => { | ||
alert('문제집 정보 수정에 실패했습니다.'); | ||
alert('이미지 저장에 실패했습니다.'); | ||
}, | ||
onSettled: () => { | ||
handleIsActive(false); | ||
handleIsLoading(false); | ||
handleIsModal(false); | ||
}, | ||
}); | ||
|
||
return UpdateWorkbook; | ||
return useUploadImgWorkbook; | ||
}; |
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
Oops, something went wrong.