1- import { Button , IconName , Intent } from '@blueprintjs/core'
21import * as React from 'react'
32
4- import { sourceChapters } from '../../reducers/states '
3+ import { Button , IconName , Intent } from '@blueprintjs/core '
54
65/**
76 * @property handleEvalEditor - A callback function for evaluation
@@ -11,40 +10,26 @@ export interface IControlProps {
1110 handleEvalEditor : ( ) => void
1211 handleEvalRepl : ( ) => void
1312 handleClearReplOutput : ( ) => void
14- handleChapterSelect : ( e : React . ChangeEvent < HTMLSelectElement > ) => void
1513}
1614
17- const genericButton = (
18- label : string ,
19- icon : IconName ,
20- handleClick = ( ) => { } ,
21- intent = Intent . NONE ,
22- notMinimal = false
23- ) => (
24- < Button
25- onClick = { handleClick }
26- className = { ( notMinimal ? '' : 'pt-minimal' ) + ' col-xs-12' }
27- intent = { intent }
28- icon = { icon }
29- >
30- { label }
31- </ Button >
32- )
33-
34- const chapterSelect = ( handleSelect = ( e : React . ChangeEvent < HTMLSelectElement > ) => { } ) => (
35- < div className = "col-xs-4 pt-select pt-select" >
36- < select defaultValue = { sourceChapters . slice ( - 1 ) [ 0 ] . toString ( ) } onChange = { handleSelect } >
37- { sourceChapters . map ( chap => (
38- < option key = { chap } value = { chap } >
39- { `Source \xa7${ chap } ` }
40- </ option >
41- ) ) }
42- </ select >
43- </ div >
44- )
45-
4615class Control extends React . Component < IControlProps , { } > {
4716 public render ( ) {
17+ const genericButton = (
18+ label : string ,
19+ icon : IconName ,
20+ handleClick = ( ) => { } ,
21+ intent = Intent . NONE ,
22+ notMinimal = false
23+ ) => (
24+ < Button
25+ onClick = { handleClick }
26+ className = { ( notMinimal ? '' : 'pt-minimal' ) + ' col-xs-12' }
27+ intent = { intent }
28+ icon = { icon }
29+ >
30+ { label }
31+ </ Button >
32+ )
4833 const runButton = genericButton ( 'Run' , 'play' , this . props . handleEvalEditor )
4934 const evalButton = genericButton ( 'Eval' , 'play' , this . props . handleEvalRepl )
5035 const clearButton = genericButton ( 'Clear' , 'remove' , this . props . handleClearReplOutput )
@@ -53,9 +38,8 @@ class Control extends React.Component<IControlProps, {}> {
5338 < div className = "col-xs-2" > { runButton } </ div >
5439 < div className = "col-xs-4" >
5540 < div className = "row" >
56- { chapterSelect ( this . props . handleChapterSelect ) }
57- < div className = "col-xs-4" > { evalButton } </ div >
58- < div className = "col-xs-4" > { clearButton } </ div >
41+ < div className = "col-xs-6" > { evalButton } </ div >
42+ < div className = "col-xs-6" > { clearButton } </ div >
5943 </ div >
6044 </ div >
6145 </ div >
0 commit comments