fix contract

This commit is contained in:
Olivier Gagnon
2021-09-09 12:52:43 -04:00
parent b7e07bc7f2
commit 3df298e91e
8 changed files with 71 additions and 45 deletions
+3 -6
View File
@@ -3,7 +3,6 @@ import { KEY } from "../../../utils/helpers/keyCodes";
import { CodingContract, CodingContractType, CodingContractTypes } from "../../CodingContracts";
import { ClickableTag, CopyableText } from "./CopyableText";
import { PopupCloseButton } from "./PopupCloseButton";
type IProps = {
c: CodingContract;
@@ -28,9 +27,6 @@ export function CodingContractPopup(props: IProps): React.ReactElement {
if (event.keyCode === KEY.ENTER && value !== "") {
event.preventDefault();
props.onAttempt(answer);
} else if (event.keyCode === KEY.ESC) {
event.preventDefault();
props.onClose();
}
}
@@ -59,8 +55,9 @@ export function CodingContractPopup(props: IProps): React.ReactElement {
onChange={onChange}
onKeyDown={onKeyDown}
/>
<PopupCloseButton popup={props.popupId} onClose={() => props.onAttempt(answer)} text={"Solve"} />
<PopupCloseButton popup={props.popupId} onClose={props.onClose} text={"Close"} />
<button className={"std-button"} onClick={() => props.onAttempt(answer)}>
Solve
</button>
</div>
);
}