File tree 6 files changed +84
-9
lines changed
6 files changed +84
-9
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,12 @@ func renderExamWindow(a *App) interface{} {
136
136
case * maths.MultipleChoice :
137
137
138
138
g := forms .NewGrid ()
139
+
140
+ r0 := g .AddRow ()
141
+ r0 .AddCol (nil )
142
+ r0 .AddCol (forms .NewTitle (k .Question , 1 )).Steps = 6
143
+ r0 .AddCol (nil )
144
+
139
145
r := g .AddRow ()
140
146
r .AddCol (nil )
141
147
@@ -174,6 +180,12 @@ func renderExamWindow(a *App) interface{} {
174
180
175
181
w .AddMenu ("Выберите наибольшее число" , nil )
176
182
g := forms .NewGrid ()
183
+
184
+ r0 := g .AddRow ()
185
+ r0 .AddCol (nil )
186
+ r0 .AddCol (forms .NewTitle ("Что больше?" , 1 )).Steps = 6
187
+ r0 .AddCol (nil )
188
+
177
189
r := g .AddRow ()
178
190
r .AddCol (nil )
179
191
@@ -231,16 +243,20 @@ func renderAnswers(a *App) interface{} {
231
243
232
244
g := forms .NewGrid ()
233
245
234
- g .AddRow ()
246
+ r0 := g .AddRow ()
247
+ r0 .AddCol (nil )
248
+ r0 .AddCol (forms .NewTitle ("Правильные ответы" , 1 )).Steps = 8
249
+ r0 .AddCol (nil )
250
+
235
251
rGrid := g .AddRow ()
236
252
237
- rGrid .AddCol (nil ). Steps = 1
253
+ rGrid .AddCol (nil )
238
254
239
255
t := forms .NewTable ()
240
256
cGrid := rGrid .AddCol (t )
241
257
cGrid .Steps = 6
242
258
243
- rGrid .AddCol (nil ). Steps = 1
259
+ rGrid .AddCol (nil )
244
260
245
261
t .AddTextColumn ("Задание" )
246
262
t .AddTextColumn ("Ответ" )
Original file line number Diff line number Diff line change @@ -16,3 +16,24 @@ func NewButton(text string, action *Action) *Button {
16
16
Action : action ,
17
17
}
18
18
}
19
+
20
+ type Label struct {
21
+ Type string `json:"type"`
22
+ Text string `json:"text"`
23
+ Level int `json:"level"`
24
+ }
25
+
26
+ func NewLabel (text string ) * Label {
27
+ return & Label {
28
+ Type : "label" ,
29
+ Text : text ,
30
+ }
31
+ }
32
+
33
+ func NewTitle (text string , level int ) * Label {
34
+ return & Label {
35
+ Type : "label" ,
36
+ Text : text ,
37
+ Level : level ,
38
+ }
39
+ }
Original file line number Diff line number Diff line change @@ -7,8 +7,13 @@ const Row = ({cols, dispatch}) => {
7
7
</ div > ;
8
8
} ;
9
9
10
- const Col = ( { content, dispatch} ) => {
11
- return < div className = "col" >
10
+ const Col = ( { content, dispatch, steps} ) => {
11
+
12
+ var style = "col" ;
13
+ if ( steps ) {
14
+ style += " col-" + steps ;
15
+ }
16
+ return < div className = { style } >
12
17
< Render { ...content } dispatch = { dispatch } />
13
18
</ div > ;
14
19
} ;
Original file line number Diff line number Diff line change 1
1
import React , { Component } from 'react' ;
2
2
3
3
4
- const Image = ( { src} ) => (
5
- < img className = "img-fluid" src = { src } />
6
- ) ;
4
+ const Image = ( { src, dispatch, action} ) => {
5
+
6
+ if ( action == null ) {
7
+ return < img className = "img-fluid" src = { src } /> ;
8
+ }
9
+
10
+ return < img className = "img-fluid" src = { src } onClick = { ( ) => dispatch ( action ) } /> ;
11
+ } ;
7
12
8
13
export default Image ;
Original file line number Diff line number Diff line change
1
+ import React , { Component } from 'react' ;
2
+
3
+
4
+ const Label = ( { text, level} ) => {
5
+
6
+ if ( level == 1 ) {
7
+ return < h1 > { text } </ h1 > ;
8
+ }
9
+ if ( level == 2 ) {
10
+ return < h2 > { text } </ h2 > ;
11
+ }
12
+
13
+ if ( level == 3 ) {
14
+ return < h3 > { text } </ h3 > ;
15
+ }
16
+
17
+ if ( level == 4 ) {
18
+ return < h4 > { text } </ h4 > ;
19
+ }
20
+
21
+ return < span > { text } </ span > ;
22
+
23
+ } ;
24
+
25
+ export default Label ;
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ import Image from './Image';
16
16
17
17
import Button from './Button' ;
18
18
19
+ import Label from './Label' ;
20
+
19
21
import Grid from './Grid' ;
20
22
21
23
import Placeholder from './Placeholder' ;
@@ -100,7 +102,8 @@ var color = [
100
102
return < Placeholder { ...rest } /> ;
101
103
case 'grid' :
102
104
return < Grid { ...rest } /> ;
103
-
105
+ case 'label' :
106
+ return < Label { ...rest } /> ;
104
107
default :
105
108
return ( < p > Unknown render type { type } </ p > ) ;
106
109
}
You can’t perform that action at this time.
0 commit comments