generated from ethereum-optimism/scaffold-op
-
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
0d5359d
commit 412ccf5
Showing
11 changed files
with
484 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React, { Dispatch, SetStateAction, useRef } from "react"; | ||
import { EtherInput } from "~~/components/scaffold-eth"; | ||
|
||
interface AllocateRewardModalProps { | ||
isOpen: boolean; | ||
onClose: () => void; | ||
onAllocate: () => void; | ||
rewardAmount: string; | ||
setRewardAmount: Dispatch<SetStateAction<string>>; | ||
} | ||
|
||
const AllocateRewardModal: React.FC<AllocateRewardModalProps> = ({ | ||
isOpen, | ||
onClose, | ||
onAllocate, | ||
rewardAmount, | ||
setRewardAmount, | ||
}) => { | ||
const modalRef = useRef<HTMLDialogElement>(null); | ||
|
||
if (isOpen) { | ||
modalRef.current?.showModal(); | ||
} else { | ||
modalRef.current?.close(); | ||
} | ||
|
||
return ( | ||
<dialog ref={modalRef} className="modal"> | ||
<div className="modal-box"> | ||
<h3 className="font-bold text-lg">Allocate Reward</h3> | ||
<EtherInput value={rewardAmount} onChange={amount => setRewardAmount(amount)} /> | ||
<button onClick={onAllocate} className="btn btn-primary mt-4"> | ||
Allocate | ||
</button> | ||
</div> | ||
<form method="dialog" className="modal-backdrop"> | ||
<button onClick={onClose}>close</button> | ||
</form> | ||
</dialog> | ||
); | ||
}; | ||
|
||
export default AllocateRewardModal; |
Oops, something went wrong.