@@ -264,7 +264,6 @@ type DemoContext = React.Context<
264264 resizable : boolean ;
265265 firstSticky : number ;
266266 lastSticky : number ;
267- customGap : boolean ;
268267 gap : number ;
269268 } >
270269> ;
@@ -276,10 +275,10 @@ export default function EC2TableDemo() {
276275 { id : 'cpuUtilization' , visible : true } ,
277276 { id : 'memoryUtilization' , visible : true } ,
278277 { id : 'networkIn' , visible : true } ,
278+ { id : 'instanceType' , visible : true } ,
279279 { id : 'networkOut' , visible : true } ,
280280 { id : 'id' , visible : true } ,
281281 { id : 'name' , visible : true } ,
282- { id : 'instanceType' , visible : true } ,
283282 { id : 'az' , visible : true } ,
284283 { id : 'state' , visible : true } ,
285284 { id : 'monthlyCost' , visible : false } ,
@@ -326,14 +325,11 @@ export default function EC2TableDemo() {
326325 const { selectedItems } = collectionProps ;
327326
328327 const {
329- urlParams : { resizable = true , firstSticky = 0 , lastSticky = 0 , customGap = false , gap = 0 } ,
328+ urlParams : { resizable = true , firstSticky = 0 , lastSticky = 0 } ,
330329 setUrlParams,
331330 } = useContext ( AppContext as DemoContext ) ;
332331
333332 // Build the CSS custom property style for the resizer gap
334- const tableWrapperStyle : React . CSSProperties = customGap
335- ? ( { '--awsui-table-resizer-block-gap' : `${ gap } px` } as React . CSSProperties )
336- : { } ;
337333
338334 return (
339335 < SimplePage title = "Grouped Column table demo with collection hooks" i18n = { { } } screenshotArea = { { } } >
@@ -364,68 +360,50 @@ export default function EC2TableDemo() {
364360 type = "number"
365361 />
366362 </ FormField >
367-
368- < Toggle onChange = { ( { detail } ) => setUrlParams ( { customGap : detail . checked } ) } checked = { customGap } >
369- Custom resizer gap
370- </ Toggle >
371-
372- < FormField label = "Resizer gap (px)" >
373- < Input
374- disabled = { ! customGap }
375- ariaLabel = "Resizer block gap in pixels"
376- onChange = { ( { detail } ) => setUrlParams ( { gap : + detail . value } ) }
377- value = { String ( gap ) }
378- name = "gap"
379- inputMode = "numeric"
380- type = "number"
381- />
382- </ FormField >
383363 </ SpaceBetween >
384364
385- < div style = { tableWrapperStyle } >
386- < Table
387- { ...collectionProps }
388- selectionType = "multi"
389- resizableColumns = { resizable }
390- stickyColumns = { {
391- first : + firstSticky ,
392- last : + lastSticky ,
393- } }
394- variant = "stacked"
395- enableKeyboardNavigation = { true }
396- ariaLabels = { ariaLabels }
397- header = {
398- < Header
399- counter = {
400- selectedItems && selectedItems . length
401- ? `(${ selectedItems . length } /${ allInstances . length } )`
402- : `(${ allInstances . length } )`
403- }
404- >
405- EC2 Instances
406- </ Header >
407- }
408- columnDefinitions = { columnDefinitions }
409- columnGroupingDefinitions = { columnGroupingDefinitions }
410- columnDisplay = { preferences ?. contentDisplay }
411- items = { items }
412- pagination = { < Pagination { ...paginationProps } /> }
413- filter = {
414- < TextFilter
415- { ...filterProps }
416- countText = { `${ filteredItemsCount } ${ filteredItemsCount === 1 ? 'match' : 'matches' } ` }
417- filteringPlaceholder = "Find instances"
418- />
419- }
420- preferences = {
421- < CollectionPreferences
422- { ...collectionPreferencesProps }
423- preferences = { preferences }
424- onConfirm = { ( { detail } ) => setPreferences ( detail ) }
425- />
426- }
427- />
428- </ div >
365+ < Table
366+ { ...collectionProps }
367+ selectionType = "multi"
368+ resizableColumns = { resizable }
369+ stickyColumns = { {
370+ first : + firstSticky ,
371+ last : + lastSticky ,
372+ } }
373+ variant = "stacked"
374+ enableKeyboardNavigation = { true }
375+ ariaLabels = { ariaLabels }
376+ header = {
377+ < Header
378+ counter = {
379+ selectedItems && selectedItems . length
380+ ? `(${ selectedItems . length } /${ allInstances . length } )`
381+ : `(${ allInstances . length } )`
382+ }
383+ >
384+ EC2 Instances
385+ </ Header >
386+ }
387+ columnDefinitions = { columnDefinitions }
388+ columnGroupingDefinitions = { columnGroupingDefinitions }
389+ columnDisplay = { preferences ?. contentDisplay }
390+ items = { items }
391+ pagination = { < Pagination { ...paginationProps } /> }
392+ filter = {
393+ < TextFilter
394+ { ...filterProps }
395+ countText = { `${ filteredItemsCount } ${ filteredItemsCount === 1 ? 'match' : 'matches' } ` }
396+ filteringPlaceholder = "Find instances"
397+ />
398+ }
399+ preferences = {
400+ < CollectionPreferences
401+ { ...collectionPreferencesProps }
402+ preferences = { preferences }
403+ onConfirm = { ( { detail } ) => setPreferences ( detail ) }
404+ />
405+ }
406+ />
429407 </ SimplePage >
430408 ) ;
431409}
0 commit comments