Skip to content

Commit dcc51cc

Browse files
committed
add basic hint styles
Signed-off-by: shmck <[email protected]>
1 parent f4f6e1c commit dcc51cc

File tree

1 file changed

+28
-12
lines changed
  • web-app/src/containers/Tutorial/components

1 file changed

+28
-12
lines changed

Diff for: web-app/src/containers/Tutorial/components/Hints.tsx

+28-12
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
11
import * as React from 'react'
2+
import Markdown from '../../../components/Markdown'
23
import Button from '../../../components/Button'
34

5+
const styles = {
6+
hints: {
7+
marginTop: '1rem',
8+
},
9+
hintList: {
10+
marginBottom: '0.5rem',
11+
},
12+
hint: {
13+
margin: '0.5rem 0',
14+
backgroundColor: 'rgba(255,229,100,0.3)',
15+
borderLeft: '#ffe564',
16+
padding: '0.5rem',
17+
},
18+
}
19+
420
interface Props {
521
hints: string[]
622
}
723

824
const Hints = (props: Props) => {
9-
const [hintIndex, setHintIndex] = React.useState(0)
25+
const [hintIndex, setHintIndex] = React.useState(-1)
1026
const isFinalHint = props.hints.length - 1 === hintIndex
11-
console.log(hintIndex)
1227
const nextHint = () => {
13-
console.log(hintIndex)
1428
if (!isFinalHint) {
1529
setHintIndex((currentHintIndex) => currentHintIndex + 1)
1630
}
1731
}
1832
return (
19-
<div>
20-
{props.hints.map((h, i) => {
21-
return i <= hintIndex ? (
22-
<div key={i} style={{ backgroundColor: 'red' }}>
23-
{h}
24-
</div>
25-
) : null
26-
})}
33+
<div style={styles.hints}>
34+
<div style={styles.hintList}>
35+
{props.hints.map((h, i) => {
36+
return i <= hintIndex ? (
37+
<div key={i} style={styles.hint}>
38+
<Markdown>{h}</Markdown>
39+
</div>
40+
) : null
41+
})}
42+
</div>
2743
<Button onClick={nextHint} disabled={isFinalHint}>
28-
Next Hint
44+
Get A Hint
2945
</Button>
3046
</div>
3147
)

0 commit comments

Comments
 (0)