We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e3a38d commit 6bf73c9Copy full SHA for 6bf73c9
web-app/src/containers/Tutorial/StagePage/Stage/StepDescription/index.tsx
@@ -18,13 +18,24 @@ interface Props {
18
}
19
20
const StepDescription = ({ text, mode, onLoadSolution }: Props) => {
21
+ const [loadedSolution, setLoadedSolution] = React.useState()
22
+
23
+ const onClickHandler = () => {
24
+ if (!loadedSolution) {
25
+ setLoadedSolution(true)
26
+ onLoadSolution()
27
+ }
28
29
30
if (mode === 'INCOMPLETE') {
31
return null
32
33
34
+ const showLoadSolution = mode === 'ACTIVE' && !loadedSolution
35
return (
36
<div style={styles.card}>
37
<Markdown>{text || ''}</Markdown>
- {mode === 'ACTIVE' && <Button onClick={onLoadSolution}>Load Solution</Button>}
38
+ {showLoadSolution && <Button onClick={onClickHandler}>Load Solution</Button>}
39
</div>
40
)
41
0 commit comments