Skip to content

Feature/solution actions #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 29, 2019
Prev Previous commit
hide loadSolution on load
  • Loading branch information
ShMcK committed Sep 29, 2019
commit 6bf73c94e2a91914c35ef595df2b03714efc0b80
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@ interface Props {
}

const StepDescription = ({ text, mode, onLoadSolution }: Props) => {
const [loadedSolution, setLoadedSolution] = React.useState()

const onClickHandler = () => {
if (!loadedSolution) {
setLoadedSolution(true)
onLoadSolution()
}
}

if (mode === 'INCOMPLETE') {
return null
}

const showLoadSolution = mode === 'ACTIVE' && !loadedSolution
return (
<div style={styles.card}>
<Markdown>{text || ''}</Markdown>
{mode === 'ACTIVE' && <Button onClick={onLoadSolution}>Load Solution</Button>}
{showLoadSolution && <Button onClick={onClickHandler}>Load Solution</Button>}
</div>
)
}
Expand Down