7
7
Customization and selection of the build command.
8
8
*/
9
9
10
- import { Alert , Dropdown , Form , Input } from "antd" ;
10
+ import { Alert , Select , Form , Input } from "antd" ;
11
11
import { List } from "immutable" ;
12
-
13
- import { DownOutlined , SaveOutlined } from "@ant-design/icons" ;
12
+ import { SaveOutlined } from "@ant-design/icons" ;
14
13
import { Button } from "@cocalc/frontend/antd-bootstrap" ;
15
14
import { React } from "@cocalc/frontend/app-framework" ;
16
- import {
17
- Icon ,
18
- Loading ,
19
- MenuItems ,
20
- Paragraph ,
21
- } from "@cocalc/frontend/components" ;
15
+ import { Icon , Loading , Paragraph } from "@cocalc/frontend/components" ;
22
16
import { split } from "@cocalc/util/misc" ;
23
17
import { Actions } from "./actions" ;
24
18
import {
@@ -74,7 +68,7 @@ export const BuildCommand: React.FC<Props> = React.memo((props: Props) => {
74
68
const [ build_command_prev , set_build_command_prev ] =
75
69
React . useState ( build_command_orig ) ;
76
70
const [ build_command , set_build_command ] = React . useState < string > (
77
- build_command_string ( build_command_orig )
71
+ build_command_string ( build_command_orig ) ,
78
72
) ;
79
73
const [ focus , set_focus ] = React . useState < boolean > ( false ) ;
80
74
const [ dirty , set_dirty ] = React . useState < boolean > ( false ) ;
@@ -91,7 +85,7 @@ export const BuildCommand: React.FC<Props> = React.memo((props: Props) => {
91
85
engine ,
92
86
filename ,
93
87
knitr ,
94
- actions . output_directory
88
+ actions . output_directory ,
95
89
) ;
96
90
actions . set_build_command ( cmd ) ;
97
91
}
@@ -100,28 +94,28 @@ export const BuildCommand: React.FC<Props> = React.memo((props: Props) => {
100
94
actions . init_build_directive ( true ) ;
101
95
}
102
96
103
- function engineOptions ( ) : MenuItems {
97
+ function engineOptions ( ) {
104
98
return ENGINES . map ( ( engine ) => {
105
99
return {
106
100
key : engine ,
101
+ value : engine ,
107
102
label : engine ,
108
- onClick : ( ) => select_engine ( engine ) ,
109
103
} ;
110
104
} ) ;
111
105
}
112
106
113
107
function render_engines ( ) : React . JSX . Element {
114
108
return (
115
- < Dropdown
109
+ < Select
110
+ style = { { width : "200px" } }
116
111
placement = { "bottomRight" }
117
- menu = { { items : engineOptions ( ) } }
118
- trigger = { [ "hover" , "click" ] }
112
+ options = { engineOptions ( ) }
119
113
disabled = { build_command_hardcoded }
114
+ onChange = { select_engine }
115
+ placeholder = "Engine..."
120
116
>
121
- < Button bsSize = { "xsmall" } >
122
- Engine < DownOutlined />
123
- </ Button >
124
- </ Dropdown >
117
+ Engine
118
+ </ Select >
125
119
) ;
126
120
}
127
121
@@ -191,7 +185,7 @@ export const BuildCommand: React.FC<Props> = React.memo((props: Props) => {
191
185
return (
192
186
< Button
193
187
disabled = { ! dirty }
194
- bsSize = { "xsmall " }
188
+ bsSize = { "small " }
195
189
bsStyle = { dirty ? "success" : undefined }
196
190
title = { "Saves the modified command (or just hit the 'Return' key)" }
197
191
onClick = { ( ) => handle_build_change ( ) }
0 commit comments