@@ -6,60 +6,63 @@ import { getRomanizations } from '../utils';
6
6
import Circle from './Circle' ;
7
7
import BigSyllable from './BigSyllable' ;
8
8
9
- const RoundHeadword = ( { params, round, shapes} ) => {
10
- let syllables = round . headword . split ( '' ) ;
11
- let slides = round . text . word ;
12
- let text = slides [ params . headword ] || slides [ 0 ] ;
13
- let next = ( parseFloat ( params . headword ) || 0 ) + 1 ;
14
- let prev = ( parseFloat ( params . headword ) || 0 ) - 1 ;
15
- let lastLetter = ( round . jamo || [ ] ) . length - 1 ;
16
- let hasMoreText = next < slides . length ;
17
- let continuePath = (
18
- hasMoreText ? `/level/${ params . level } /round/${ params . round } /headword/${ next } `
19
- : `/level/${ params . level } /round/${ params . round } /ready`
20
- ) ;
21
- let backPath = (
22
- prev >= 0 ? `/level/${ params . level } /round/${ params . round } /headword${ prev > 0 ? `/${ prev } ` : '' } `
23
- : round . jamo ? `/level/${ params . level } /round/${ params . round } /letter${ lastLetter > 0 ? `/${ lastLetter } ` : '' } `
24
- : `/level/${ params . level } /round/${ params . round } /intro${ round . text . intro . length ? `/${ round . text . intro . length - 1 } ` : '' } `
25
- ) ;
26
- let phonetics = getRomanizations ( round . headword , true ) ;
27
- return (
28
- < div className = { classNames ( "round__headword" , {
29
- 'one-syllable' : syllables . length === 1 ,
30
- } ) } >
31
- < div className = "round__headword__word" >
32
- < Circle />
33
- < label > Round Keyword</ label >
34
- < div className = "round__headword__syllables" >
35
- { syllables . map ( ( syllable , i ) =>
36
- < div className = "round__headword__syllable" key = { syllable } >
37
- < BigSyllable syllable = { syllable } shapes = { shapes } />
38
- < p className = "round__headword__syllable__phonetics" >
39
- { phonetics . syllables [ i ] . ideal }
40
- </ p >
41
- </ div >
42
- ) }
9
+ class RoundHeadword extends React . Component {
10
+ render ( ) {
11
+ let { params, round, shapes} = this . props ;
12
+ let syllables = round . headword . split ( '' ) ;
13
+ let slides = round . text . word ;
14
+ let text = slides [ params . headword ] || slides [ 0 ] ;
15
+ let next = ( parseFloat ( params . headword ) || 0 ) + 1 ;
16
+ let prev = ( parseFloat ( params . headword ) || 0 ) - 1 ;
17
+ let lastLetter = ( round . jamo || [ ] ) . length - 1 ;
18
+ let hasMoreText = next < slides . length ;
19
+ let continuePath = (
20
+ hasMoreText ? `/level/${ params . level } /round/${ params . round } /headword/${ next } `
21
+ : `/level/${ params . level } /round/${ params . round } /ready`
22
+ ) ;
23
+ let backPath = (
24
+ prev >= 0 ? `/level/${ params . level } /round/${ params . round } /headword${ prev > 0 ? `/${ prev } ` : '' } `
25
+ : round . jamo ? `/level/${ params . level } /round/${ params . round } /letter${ lastLetter > 0 ? `/${ lastLetter } ` : '' } `
26
+ : `/level/${ params . level } /round/${ params . round } /intro${ round . text . intro . length ? `/${ round . text . intro . length - 1 } ` : '' } `
27
+ ) ;
28
+ let phonetics = getRomanizations ( round . headword , true ) ;
29
+ return (
30
+ < div className = { classNames ( "round__headword" , {
31
+ 'one-syllable' : syllables . length === 1 ,
32
+ } ) } >
33
+ < div className = "round__headword__word" >
34
+ < Circle />
35
+ < label > Round Keyword</ label >
36
+ < div className = "round__headword__syllables" >
37
+ { syllables . map ( ( syllable , i ) =>
38
+ < div className = "round__headword__syllable" key = { syllable } >
39
+ < BigSyllable syllable = { syllable } shapes = { shapes } />
40
+ < p className = "round__headword__syllable__phonetics" >
41
+ { phonetics . syllables [ i ] . ideal }
42
+ </ p >
43
+ </ div >
44
+ ) }
45
+ </ div >
43
46
</ div >
44
- </ div >
45
47
46
- < div className = "round__headword__content" >
47
- < Circle />
48
- < div className = "round__headword__content__inner" >
49
- < Markdown source = { text } />
50
- </ div >
48
+ < div className = "round__headword__content" >
49
+ < Circle />
50
+ < div className = "round__headword__content__inner" >
51
+ < Markdown source = { text } />
52
+ </ div >
51
53
52
- < div className = "round__headword__buttons back-forward-buttons" >
53
- < Link className = "button button--back button--link" to = { backPath } >
54
- Back
55
- </ Link >
56
- < Link className = "button button--forward" to = { continuePath } data-autofocus = "true" >
57
- Continue
58
- </ Link >
54
+ < div className = "round__headword__content__buttons back-forward-buttons" >
55
+ < Link className = "button button--back button--link" to = { backPath } >
56
+ Back
57
+ </ Link >
58
+ < Link className = "button button--forward" to = { continuePath } data-autofocus = "true" >
59
+ Continue
60
+ </ Link >
61
+ </ div >
59
62
</ div >
60
63
</ div >
61
- </ div >
62
- ) ;
63
- } ;
64
+ ) ;
65
+ }
66
+ }
64
67
65
68
export default RoundHeadword ;
0 commit comments