@@ -32,14 +32,15 @@ import {
32
32
FormGroup ,
33
33
Select ,
34
34
SelectGroup ,
35
+ SelectProps ,
35
36
SelectOption ,
36
37
SelectOptionObject ,
37
38
TextInput ,
38
39
} from "@patternfly/react-core"
39
40
40
41
import HomeIcon from "@patternfly/react-icons/dist/esm/icons/home-icon"
41
42
import InfoIcon from "@patternfly/react-icons/dist/esm/icons/info-circle-icon"
42
- import ChoiceIcon from "@patternfly/react-icons/dist/esm/icons/lightbulb -icon"
43
+ import ChoiceIcon from "@patternfly/react-icons/dist/esm/icons/user-cog -icon"
43
44
44
45
import "../../web/scss/components/Ask.scss"
45
46
@@ -120,11 +121,11 @@ export default class AskUI extends React.PureComponent<Props, State> {
120
121
121
122
private card ( title : string , body : React . ReactNode ) {
122
123
return (
123
- < Card isLarge className = "sans-serif flex-fill " >
124
+ < Card isPlain className = "sans-serif" >
124
125
< CardHeader >
125
126
< CardTitle >
126
127
< div className = "flex-layout" >
127
- < ChoiceIcon className = "larger-text slightly-deemphasize small-right-pad" /> { title . replace ( / \? $ / , "" ) }
128
+ < ChoiceIcon className = "larger-text slightly-deemphasize small-right-pad" /> Configure
128
129
</ div >
129
130
</ CardTitle >
130
131
< CardActions hasNoOffset > { this . actions ( ) } </ CardActions >
@@ -217,6 +218,11 @@ export default class AskUI extends React.PureComponent<Props, State> {
217
218
// Intentionally empty
218
219
}
219
220
221
+ /** Format title for presentation */
222
+ private title ( ask : Ask ) {
223
+ return ask . title . replace ( / \? $ / , "" )
224
+ }
225
+
220
226
/** Render a UI for making a selection */
221
227
private select ( ask : Ask < Prompts . Select > ) {
222
228
const suggested = ask . prompt . choices . find ( ( _ ) => _ . name === this . state ?. userSelection )
@@ -249,21 +255,20 @@ export default class AskUI extends React.PureComponent<Props, State> {
249
255
250
256
const onFilter = ( evt : React . ChangeEvent | null , filter : string ) => mkOptions ( filter )
251
257
252
- const placeholderText = "Select an option"
253
258
const titleId = "kui--madwizard-ask-ui-title"
254
259
255
- const props = {
260
+ const props : SelectProps = {
256
261
isOpen : true ,
262
+ isPlain : true ,
257
263
isGrouped : true ,
258
264
hasInlineFilter : true ,
259
265
isInputValuePersisted : true ,
260
266
isInputFilterPersisted : true ,
261
- // variant: "typeahead" as const,
262
- // typeAheadAriaLabel: "Select an option",
263
267
onFilter,
264
268
"aria-labelledby" : titleId ,
265
269
noResultsFoundText : "No matching choices" ,
266
- placeholderText,
270
+ placeholderText : this . title ( ask ) , // place the guidebook title here
271
+ inlineFilterPlaceholderText : "Filter choices" ,
267
272
onSelect : this . _onSelect ,
268
273
onToggle : this . _doNothing ,
269
274
toggleIndicator : < React . Fragment /> ,
@@ -272,9 +277,7 @@ export default class AskUI extends React.PureComponent<Props, State> {
272
277
273
278
return (
274
279
< React . Fragment >
275
- < span id = { titleId } hidden >
276
- { placeholderText }
277
- </ span >
280
+ < span id = { titleId } hidden />
278
281
{ this . card ( ask . title , < Select { ...props } /> ) }
279
282
</ React . Fragment >
280
283
)
@@ -297,26 +300,33 @@ export default class AskUI extends React.PureComponent<Props, State> {
297
300
298
301
return this . card (
299
302
ask . title ,
300
- < Form onSubmit = { this . _onFormSubmit } >
301
- < Grid hasGutter md = { 6 } >
302
- { ask . prompt . choices . map ( ( _ ) => (
303
- < FormGroup isRequired key = { _ . name } label = { _ . name } >
304
- < TextInput
305
- aria-label = { `text-input-${ _ . name } ` }
306
- isRequired
307
- value = { form [ _ . name ] }
308
- onChange = { ( value ) => ( form [ _ . name ] = value ) }
309
- />
310
- </ FormGroup >
311
- ) ) }
312
- </ Grid >
313
-
314
- < ActionGroup >
315
- < Button variant = "primary" type = "submit" >
316
- Next
317
- </ Button >
318
- </ ActionGroup >
319
- </ Form >
303
+ < Card >
304
+ < CardHeader >
305
+ < CardTitle > { this . title ( ask ) } </ CardTitle >
306
+ </ CardHeader >
307
+ < CardBody >
308
+ < Form onSubmit = { this . _onFormSubmit } >
309
+ < Grid hasGutter md = { 6 } >
310
+ { ask . prompt . choices . map ( ( _ ) => (
311
+ < FormGroup isRequired key = { _ . name } label = { _ . name } >
312
+ < TextInput
313
+ aria-label = { `text-input-${ _ . name } ` }
314
+ isRequired
315
+ value = { form [ _ . name ] }
316
+ onChange = { ( value ) => ( form [ _ . name ] = value ) }
317
+ />
318
+ </ FormGroup >
319
+ ) ) }
320
+ </ Grid >
321
+
322
+ < ActionGroup >
323
+ < Button variant = "primary" type = "submit" >
324
+ Next
325
+ </ Button >
326
+ </ ActionGroup >
327
+ </ Form >
328
+ </ CardBody >
329
+ </ Card >
320
330
)
321
331
}
322
332
0 commit comments