-
Notifications
You must be signed in to change notification settings - Fork 1
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
592c4eb
commit ade872c
Showing
6 changed files
with
161 additions
and
27 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
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,69 @@ | ||
import React, { useState } from 'react'; | ||
|
||
// @ts-ignore | ||
import { InlineMath } from 'react-katex'; | ||
|
||
import { | ||
PauliMinus, | ||
PauliPlus, | ||
} from '../simulationUtils'; | ||
|
||
export default function RemoveBathModal({ onCancel, onSubmit, disabledOptions }) { | ||
const operatorSelectOptions = { | ||
Sp: PauliPlus, | ||
Sm: PauliMinus | ||
} | ||
const [operatorSelected, setOperatorSelected] = useState<'Sp' | 'Sm' | undefined>(); | ||
return ( | ||
<div | ||
style={{ | ||
position: "absolute", | ||
color: "white", | ||
fontFamily: "monospace", | ||
fontSize: 20, | ||
bottom: 40, | ||
left: "50%", | ||
transform: "translateX(-50%)", | ||
background: "#252525", | ||
padding: "10px 12px", | ||
border: "1px solid white", | ||
}} | ||
> | ||
Operator:{" "} | ||
{Object.entries(operatorSelectOptions).map(([key, operator]) => ( | ||
<label key={key}> | ||
<input | ||
type="radio" | ||
value={key} | ||
onChange={(e) => setOperatorSelected(e.target.value as 'Sm' | 'Sp')} | ||
checked={operatorSelected === key} | ||
disabled={disabledOptions.includes(key)} | ||
/> | ||
<InlineMath>{operator.label}</InlineMath> | ||
</label> | ||
))} | ||
<div | ||
style={{ | ||
display: "flex", | ||
flexDirection: "row", | ||
width: "100%", | ||
justifyContent: "space-around", | ||
margin: "20px 0 10px 0", | ||
}} | ||
> | ||
<button | ||
style={{ padding: "10px 30px" }} | ||
disabled={operatorSelected === undefined} | ||
onClick={() => onSubmit({ | ||
operatorKey: operatorSelected, | ||
})} | ||
> | ||
OK | ||
</button> | ||
<button style={{ padding: "10px 30px" }} onClick={onCancel}> | ||
Cancel | ||
</button> | ||
</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