@@ -28,6 +28,7 @@ import {HidingColumnsAllowsResizing} from './HidingColumnsAllowsResizing';
28
28
import { IllustratedMessage } from '@react-spectrum/illustratedmessage' ;
29
29
import { Link } from '@react-spectrum/link' ;
30
30
import { LoadingState , SelectionMode } from '@react-types/shared' ;
31
+ import NoSearchResults from '@spectrum-icons/illustrations/NoSearchResults' ;
31
32
import { Radio , RadioGroup } from '@react-spectrum/radio' ;
32
33
import React , { Key , useState } from 'react' ;
33
34
import { SearchField } from '@react-spectrum/searchfield' ;
@@ -1361,6 +1362,15 @@ storiesOf('TableView', module)
1361
1362
( ) => (
1362
1363
< HidingColumnsAllowsResizing />
1363
1364
)
1365
+ )
1366
+ . add (
1367
+ 'zoom resizing table' ,
1368
+ ( ) => (
1369
+ < div style = { { position : 'absolute' , height : 'calc(100vh-32px)' , width : 'calc(100vw - 32px)' } } >
1370
+ < ZoomResizing />
1371
+ </ div >
1372
+ ) ,
1373
+ { description : { data : 'Using browser zoom should not trigger an infinite resizing loop. CMD+"+" to zoom in and CMD+"-" to zoom out.' } }
1364
1374
) ;
1365
1375
1366
1376
function AsyncLoadingExample ( props ) {
@@ -1709,3 +1719,46 @@ export function TableWithBreadcrumbs() {
1709
1719
</ Flex >
1710
1720
) ;
1711
1721
}
1722
+
1723
+
1724
+ function EmptyState ( ) {
1725
+ return (
1726
+ < IllustratedMessage >
1727
+ < NoSearchResults />
1728
+ < Heading > No results</ Heading >
1729
+ </ IllustratedMessage >
1730
+ ) ;
1731
+ }
1732
+
1733
+ function ZoomResizing ( ) {
1734
+ const [ child , setChild ] = useState ( 'loader' ) ;
1735
+
1736
+ return (
1737
+ < div className = "App" style = { { height : '100vh' } } >
1738
+ < RadioGroup
1739
+ label = "Child type"
1740
+ orientation = "horizontal"
1741
+ value = { child }
1742
+ onChange = { setChild } >
1743
+ < Radio value = "loader" > Loading state</ Radio >
1744
+ < Radio value = "empty" > Empty state</ Radio >
1745
+ </ RadioGroup >
1746
+ < Flex height = "100%" >
1747
+ < TableView
1748
+ height = "100%"
1749
+ width = "100%"
1750
+ renderEmptyState = { child === 'empty' ? ( ) => < EmptyState /> : undefined } >
1751
+ < TableHeader >
1752
+ < Column > column</ Column >
1753
+ </ TableHeader >
1754
+ < TableBody
1755
+ items = { [ ] }
1756
+ loadingState = { child === 'loader' ? 'loading' : undefined } >
1757
+ { ( item ) => < Row > { ( column ) => < Cell > { item [ column ] } </ Cell > } </ Row > }
1758
+ </ TableBody >
1759
+ </ TableView >
1760
+ </ Flex >
1761
+ </ div >
1762
+ ) ;
1763
+ }
1764
+
0 commit comments