1
1
import * as React from 'react' ;
2
-
3
2
import {
4
3
Bullseye ,
5
4
Card ,
6
5
CardBody ,
7
6
CardTitle ,
7
+ DrawerActions ,
8
+ DrawerColorVariant ,
9
+ DrawerHead ,
10
+ DrawerPanelBody ,
11
+ DrawerPanelContent ,
8
12
Gallery ,
9
13
Grid ,
10
14
GridItem ,
11
15
InputGroup ,
12
16
Label ,
13
- PageSection ,
14
17
TextInput ,
15
18
ToggleGroup ,
16
19
ToggleGroupItem ,
@@ -20,9 +23,11 @@ import {
20
23
} from '@patternfly/react-core' ;
21
24
import { IStepProps } from '../types' ;
22
25
import './Catalog.css' ;
23
- import CogIcon from ' @patternfly/react-icons /dist/esm/icons/cog-icon' ;
26
+ import { DrawerCloseButton } from " @patternfly/react-core /dist/js" ;
24
27
25
28
interface ICatalog {
29
+ isCatalogExpanded : boolean ,
30
+ onClosePanelClick : ( e : any ) => void ,
26
31
steps : IStepProps [ ]
27
32
}
28
33
@@ -55,7 +60,7 @@ const Catalog = (props: ICatalog) => {
55
60
* the characters in the search query
56
61
*/
57
62
return items . filter ( ( item ) => {
58
- if ( isSelected === item . type ) {
63
+ if ( isSelected === item . type ) {
59
64
return item . name . toLowerCase ( ) . indexOf ( query . toLowerCase ( ) ) > - 1 ;
60
65
} else {
61
66
return false ;
@@ -64,78 +69,88 @@ const Catalog = (props: ICatalog) => {
64
69
}
65
70
66
71
return (
67
- < PageSection style = { { backgroundColor : '#F9F9F9' } } >
68
- < Toolbar id = { 'toolbar' } style = { { background : 'transparent' } } >
69
- < ToolbarContent > { (
70
- < >
71
- < ToolbarItem >
72
- < InputGroup >
73
- < TextInput name = { 'stepSearch' }
74
- id = { 'stepSearch' }
75
- type = { 'search' }
76
- placeholder = { 'search for a step...' }
77
- aria-label = { 'search for a step' }
78
- value = { query }
79
- onChange = { changeSearch } />
80
- </ InputGroup >
81
- </ ToolbarItem >
82
- < ToolbarItem variant = { 'separator' } />
83
- < ToolbarItem >
84
- < ToggleGroup aria-label = { 'Icon variant toggle group' } >
85
- < ToggleGroupItem text = { 'start' }
86
- aria-label = { 'copy icon button' }
87
- buttonId = { 'START' }
88
- isSelected = { isSelected === 'START' }
89
- onChange = { handleItemClick } />
90
- < ToggleGroupItem icon = { < CogIcon /> }
91
- aria-label = { 'undo icon button' }
92
- buttonId = { 'MIDDLE' }
93
- isSelected = { isSelected === 'MIDDLE' }
94
- onChange = { handleItemClick } />
95
- < ToggleGroupItem text = { 'end' }
96
- aria-label = { 'share square icon button' }
97
- buttonId = { 'END' }
98
- isSelected = { isSelected === 'END' }
99
- onChange = { handleItemClick } />
100
- </ ToggleGroup >
101
- </ ToolbarItem >
102
- </ >
103
- ) } </ ToolbarContent >
104
- </ Toolbar >
105
- < Gallery hasGutter = { true } style = { { maxHeight : '650px' , overflow : 'auto' } } >
106
- { steps && search ( steps ) . map ( ( step , idx ) => {
107
- return (
108
- < Card key = { idx }
109
- className = { 'step' }
110
- isCompact = { true }
111
- isHoverable = { true }
112
- draggable = "true"
113
- onDragStart = { ( e : any ) => {
114
- e . dataTransfer . setData ( 'text/plain' , JSON . stringify ( step ) ) ;
115
- } } >
116
- < Grid md = { 6 } >
117
- < GridItem span = { 2 } >
118
- < Bullseye >
119
- < img src = { step . icon } className = { 'stepImage' } alt = { 'Step Image' } />
120
- </ Bullseye >
121
- </ GridItem >
122
- < GridItem span = { 7 } >
123
- < CardTitle >
124
- < span > { step . name } </ span >
125
- </ CardTitle >
126
- < CardBody >
127
- { shorten ( step . description , 60 ) }
128
- </ CardBody >
129
- </ GridItem >
130
- < GridItem span = { 3 } >
131
- < Label color = { 'blue' } className = { 'stepLabel' } > SOURCE</ Label >
132
- </ GridItem >
133
- </ Grid >
134
- </ Card >
135
- ) ;
136
- } ) }
137
- </ Gallery >
138
- </ PageSection >
72
+ < DrawerPanelContent minSize = { '525px' } colorVariant = { DrawerColorVariant . light200 } >
73
+ < DrawerHead >
74
+ < h3 className = { 'pf-c-title pf-m-2xl' } tabIndex = { props . isCatalogExpanded ? 0 : - 1 } >
75
+ Step Details
76
+ </ h3 >
77
+ < DrawerActions >
78
+ < DrawerCloseButton onClick = { props . onClosePanelClick } />
79
+ </ DrawerActions >
80
+ </ DrawerHead >
81
+ < DrawerPanelBody >
82
+ < Toolbar id = { 'toolbar' } style = { { background : 'transparent' } } >
83
+ < ToolbarContent > { (
84
+ < >
85
+ < ToolbarItem >
86
+ < InputGroup >
87
+ < TextInput name = { 'stepSearch' }
88
+ id = { 'stepSearch' }
89
+ type = { 'search' }
90
+ placeholder = { 'search for a step...' }
91
+ aria-label = { 'search for a step' }
92
+ value = { query }
93
+ onChange = { changeSearch } />
94
+ </ InputGroup >
95
+ </ ToolbarItem >
96
+ < ToolbarItem variant = { 'separator' } />
97
+ < ToolbarItem >
98
+ < ToggleGroup aria-label = { 'Icon variant toggle group' } >
99
+ < ToggleGroupItem text = { 'start' }
100
+ aria-label = { 'sources button' }
101
+ buttonId = { 'START' }
102
+ isSelected = { isSelected === 'START' }
103
+ onChange = { handleItemClick } />
104
+ < ToggleGroupItem icon = { 'actions' }
105
+ aria-label = { 'actions button' }
106
+ buttonId = { 'MIDDLE' }
107
+ isSelected = { isSelected === 'MIDDLE' }
108
+ onChange = { handleItemClick } />
109
+ < ToggleGroupItem text = { 'end' }
110
+ aria-label = { 'sinks button' }
111
+ buttonId = { 'END' }
112
+ isSelected = { isSelected === 'END' }
113
+ onChange = { handleItemClick } />
114
+ </ ToggleGroup >
115
+ </ ToolbarItem >
116
+ </ >
117
+ ) } </ ToolbarContent >
118
+ </ Toolbar >
119
+ < Gallery hasGutter = { true } style = { { maxHeight : '650px' , overflow : 'auto' } } >
120
+ { steps && search ( steps ) . map ( ( step , idx ) => {
121
+ return (
122
+ < Card key = { idx }
123
+ className = { 'step' }
124
+ isCompact = { true }
125
+ isHoverable = { true }
126
+ draggable = { 'true' }
127
+ onDragStart = { ( e : any ) => {
128
+ e . dataTransfer . setData ( 'text/plain' , JSON . stringify ( step ) ) ;
129
+ } } >
130
+ < Grid md = { 6 } >
131
+ < GridItem span = { 2 } >
132
+ < Bullseye >
133
+ < img src = { step . icon } className = { 'stepImage' } alt = { 'Step Image' } />
134
+ </ Bullseye >
135
+ </ GridItem >
136
+ < GridItem span = { 7 } >
137
+ < CardTitle >
138
+ < span > { step . name } </ span >
139
+ </ CardTitle >
140
+ < CardBody >
141
+ { shorten ( step . description , 60 ) }
142
+ </ CardBody >
143
+ </ GridItem >
144
+ < GridItem span = { 3 } >
145
+ < Label color = { 'blue' } className = { 'stepLabel' } > SOURCE</ Label >
146
+ </ GridItem >
147
+ </ Grid >
148
+ </ Card >
149
+ ) ;
150
+ } ) }
151
+ </ Gallery >
152
+ </ DrawerPanelBody >
153
+ </ DrawerPanelContent >
139
154
) ;
140
155
} ;
141
156
0 commit comments