Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdcc51cc

Browse files
committed
add basic hint styles
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentf4f6e1c commitdcc51cc

File tree

1 file changed

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

1 file changed

+28
-12
lines changed

‎web-app/src/containers/Tutorial/components/Hints.tsx

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
11
import*asReactfrom'react'
2+
importMarkdownfrom'../../../components/Markdown'
23
importButtonfrom'../../../components/Button'
34

5+
conststyles={
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
interfaceProps{
521
hints:string[]
622
}
723

824
constHints=(props:Props)=>{
9-
const[hintIndex,setHintIndex]=React.useState(0)
25+
const[hintIndex,setHintIndex]=React.useState(-1)
1026
constisFinalHint=props.hints.length-1===hintIndex
11-
console.log(hintIndex)
1227
constnextHint=()=>{
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-
returni<=hintIndex ?(
22-
<divkey={i}style={{backgroundColor:'red'}}>
23-
{h}
24-
</div>
25-
) :null
26-
})}
33+
<divstyle={styles.hints}>
34+
<divstyle={styles.hintList}>
35+
{props.hints.map((h,i)=>{
36+
returni<=hintIndex ?(
37+
<divkey={i}style={styles.hint}>
38+
<Markdown>{h}</Markdown>
39+
</div>
40+
) :null
41+
})}
42+
</div>
2743
<ButtononClick={nextHint}disabled={isFinalHint}>
28-
Next Hint
44+
Get A Hint
2945
</Button>
3046
</div>
3147
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp