-
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.
Merge pull request #34 from HappyScrolls/feature/#30_commonSchedule
Feature/#30 common schedule
- Loading branch information
Showing
7 changed files
with
202 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React from "react"; | ||
import { ISModalProps } from "../../types/ISModalProps"; | ||
import { styled } from "styled-components"; | ||
|
||
const OneBtnModal: React.FC<ISModalProps> = ({ | ||
title, | ||
description, | ||
imageSrc, | ||
confirmText = "확인", | ||
onConfirm, | ||
}) => { | ||
return ( | ||
<> | ||
{console.log("모달 열림")} | ||
<ModalOverlay> | ||
<ModalContent> | ||
{imageSrc && <ModalImage src={imageSrc} alt="modal image" />} | ||
<ModalTitle>{title}</ModalTitle> | ||
{description && <ModalDescription>{description}</ModalDescription>} | ||
<ModalButtonWrapper> | ||
<ModalButton onClick={onConfirm}>{confirmText}</ModalButton> | ||
</ModalButtonWrapper> | ||
</ModalContent> | ||
</ModalOverlay> | ||
</> | ||
); | ||
}; | ||
|
||
export default OneBtnModal; | ||
|
||
const ModalOverlay = styled.div` | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background: rgba(0, 0, 0, 0.5); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 10; | ||
`; | ||
|
||
const ModalContent = styled.div` | ||
padding: 20px; | ||
border-radius: 20px; | ||
background: #fff; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
`; | ||
|
||
const ModalTitle = styled.h2` | ||
color: var(--Black, #3b3634); | ||
text-align: center; | ||
font-family: SUIT; | ||
font-size: 10px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
`; | ||
|
||
const ModalDescription = styled.div` | ||
margin-top: 5px; | ||
color: var(--Primary, #f14040); | ||
font-family: SUIT; | ||
font-size: 8px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
`; | ||
|
||
const ModalImage = styled.img` | ||
width: 100px; | ||
height: 100px; | ||
`; | ||
|
||
const ModalButtonWrapper = styled.div` | ||
display: flex; | ||
margin-top: 10px; | ||
gap: 20px; | ||
`; | ||
|
||
const ModalButton = styled.button` | ||
border-radius: 10px; | ||
width: 90px; | ||
padding: 9px 0px 8px 0px; | ||
border-radius: 10px; | ||
background: #f25454; | ||
box-shadow: 0px 0px 4px 1px rgba(0, 0, 0, 0.25); | ||
color: #fff; | ||
text-align: center; | ||
font-family: SUIT; | ||
font-size: 10px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: normal; | ||
`; |
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,26 @@ | ||
import { useMutation } from "@tanstack/react-query"; | ||
import { changeCommonSchedule } from "../api/schedule/scheduleAPI"; | ||
import { AxiosError } from "axios"; | ||
|
||
export const useChangeCommonSchedule = () => { | ||
return useMutation({ | ||
mutationFn: (scheduleNo: number) => changeCommonSchedule(scheduleNo), | ||
onError: (error: unknown) => { | ||
if (error instanceof AxiosError) { | ||
if (error.response) { | ||
console.error( | ||
"서버 에러:", | ||
error.response.status, | ||
error.response.data | ||
); | ||
} else if (error.request) { | ||
console.error("Request failed 실패:", error.request); | ||
} else { | ||
console.error("Error message 에러:", error.message); | ||
} | ||
} else { | ||
console.error("Unknown error:", error); | ||
} | ||
}, | ||
}); | ||
}; |
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