-
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
Showing
31 changed files
with
287 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,48 @@ | ||
import React from 'react' | ||
import React, { useState } from 'react' | ||
|
||
import style from '@/components/modals/RatingModal.module.css' | ||
import Swal from 'sweetalert2' | ||
import ConfirmModal from './ConfirmModal'; | ||
import { useRouter } from 'next/router'; | ||
|
||
export default function SkinPurchaseModal(props: { myBlock: number, blockQuantity: number, skinName: string, setShowModal: React.Dispatch<React.SetStateAction<boolean>>, handlePurchase: () => void }) { | ||
|
||
const router = useRouter(); | ||
const [showConfirmModal, setShowConfirmModal] = useState<boolean>(false); | ||
|
||
const alertSwal = () => { | ||
Swal.fire({ | ||
icon: 'warning', | ||
text: '블럭이 부족합니다.', | ||
showConfirmButton: false, | ||
timer: 2000 | ||
}).then(result => { | ||
props.setShowModal(false); | ||
router.push('/blockcharge'); | ||
}) | ||
} | ||
|
||
const confirmModal = () => { | ||
props.setShowModal(false) | ||
setShowConfirmModal(true); | ||
} | ||
|
||
return ( | ||
<div className={style.modalBox}> | ||
<div className={style.modal}> | ||
<div className={style.skinPurchaseModalBox}> | ||
<p className={style.myBlock}>내 블럭 : {props.myBlock}개</p> | ||
<p className={style.useBlock}>블럭 {props.blockQuantity}개를 사용하여</p> | ||
<p className={style.useBlock}><span>{props.skinName}</span></p> | ||
<p className={style.useBlock}>구매하시겠습니까?</p> | ||
<div className={style.confirmBox}> | ||
<button type='button' className={style.confirmBtn} onClick={props.handlePurchase}>확인</button> | ||
<button type='button' className={style.cancle} onClick={() => props.setShowModal(false)}>취소</button> | ||
<> | ||
<div className={style.modalBox}> | ||
<div className={style.modal}> | ||
<div className={style.skinPurchaseModalBox}> | ||
<p className={style.myBlock}>내 블럭 : {props.myBlock}개</p> | ||
<p className={style.useBlock}>블럭 {props.blockQuantity}개를 사용하여</p> | ||
<p className={style.useBlock}><span>{props.skinName}</span></p> | ||
<p className={style.useBlock}>구매하시겠습니까?</p> | ||
<div className={style.confirmBox}> | ||
<button type='button' className={style.confirmBtn} onClick={props.myBlock >= props.blockQuantity ? props.handlePurchase : () => alertSwal()}>확인</button> | ||
<button type='button' className={style.cancle} onClick={() => props.setShowModal(false)}>취소</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div > | ||
</> | ||
) | ||
} |
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
Oops, something went wrong.