Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
subtleGradient committed Mar 10, 2020
1 parent 441a442 commit 51e719b
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions src/TypeThing.tsx
Expand Up @@ -13,12 +13,7 @@ function OPTypeBinaryText({ type }: { type: OPT512Maybe }) {

const SEPARATOR = `!`;

export function TypeThing({
selected = false,
defaultType,
onClose = null,
onChangeText = null,
}) {
export function TypeThing({ selected = false, defaultType, onClose = null, onChangeText = null }) {
const [isOpen, setIsOpen] = React.useState(selected);
const [opType, opTypeActions] = useUndo({
name: String(defaultType.split(SEPARATOR)[1] || ""),
Expand All @@ -30,20 +25,9 @@ export function TypeThing({

React.useEffect(() => {
if (onChangeText) {
onChangeText(
`${typeText}${
opType.present.name ? SEPARATOR + opType.present.name : ""
}`,
);
onChangeText(`${typeText}${opType.present.name ? SEPARATOR + opType.present.name : ""}`);
}
}, [opType.present.name, typeText]);
// React.useEffect(() => {
// if (defaultType) {
// const type = parseCoinText(cleanCoinText(defaultType));
// console.log("defaultType", defaultType, type);
// opTypeActions.set(type);
// }
// }, [defaultType]);

return (
<div
Expand Down Expand Up @@ -74,27 +58,26 @@ export function TypeThing({
<OP_Type opType={opTypeInstance} />
</div>
{isOpen && (
<div style={{ minWidth: 500 }}>
<div
style={
{
// minWidth: 500
}
}
>
<div
style={{
display: "flex",
flexWrap: "wrap",
flexDirection: "row",
padding: `1ex`,
background: "#eee",
}}
>
<button
key="undo"
onClick={opTypeActions.undo}
disabled={!opTypeActions.canUndo}
>
<button key="undo" onClick={opTypeActions.undo} disabled={!opTypeActions.canUndo}>
undo
</button>
<button
key="redo"
onClick={opTypeActions.redo}
disabled={!opTypeActions.canRedo}
>
<button key="redo" onClick={opTypeActions.redo} disabled={!opTypeActions.canRedo}>
redo
</button>
<button
Expand Down

0 comments on commit 51e719b

Please sign in to comment.