@@ -13,7 +13,6 @@ import {Droppable} from '@react-aria/dnd/stories/dnd.stories';
13
13
import Edit from '@spectrum-icons/workflow/Edit' ;
14
14
import FileTxt from '@spectrum-icons/workflow/FileTxt' ;
15
15
import { Flex } from '@react-spectrum/layout' ;
16
- import Folder from '@spectrum-icons/workflow/Folder' ;
17
16
import { Heading , Text } from '@react-spectrum/text' ;
18
17
import { IllustratedMessage } from '@react-spectrum/illustratedmessage' ;
19
18
import { Image } from '@react-spectrum/image' ;
@@ -25,6 +24,7 @@ import React, {useEffect, useState} from 'react';
25
24
import { storiesOf } from '@storybook/react' ;
26
25
import { useAsyncList , useListData } from '@react-stately/data' ;
27
26
import { useDragHooks , useDropHooks } from '@react-spectrum/dnd' ;
27
+ import { useSlotProps , useStyleProps } from '@react-spectrum/utils' ;
28
28
29
29
const parameters = {
30
30
args : {
@@ -94,16 +94,38 @@ const items: any = [
94
94
95
95
// taken from https://random.dog/
96
96
const itemsWithThumbs = [
97
+ { key : '0' , title : 'folder of good bois' , illustration : < Folder /> } ,
97
98
{ key : '1' , title : 'swimmer' , url : 'https://random.dog/b2fe2172-cf11-43f4-9c7f-29bd19601712.jpg' } ,
98
99
{ key : '2' , title : 'chocolate' , url : 'https://random.dog/2032518a-eec8-4102-9d48-3dca5a26eb23.png' } ,
99
100
{ key : '3' , title : 'good boi' , url : 'https://random.dog/191091b2-7d69-47af-9f52-6605063f1a47.jpg' } ,
100
101
{ key : '4' , title : 'polar bear' , url : 'https://random.dog/c22c077e-a009-486f-834c-a19edcc36a17.jpg' } ,
101
102
{ key : '5' , title : 'cold boi' , url : 'https://random.dog/093a41da-e2c0-4535-a366-9ef3f2013f73.jpg' } ,
102
103
{ key : '6' , title : 'pilot' , url : 'https://random.dog/09f8ecf4-c22b-49f4-af24-29fb5c8dbb2d.jpg' } ,
103
104
{ key : '7' , title : 'nerd' , url : 'https://random.dog/1a0535a6-ca89-4059-9b3a-04a554c0587b.jpg' } ,
104
- { key : '8' , title : 'audiophile' , url : 'https://random.dog/32367-2062-4347.jpg' }
105
+ { key : '8' , title : 'audiophile' , url : 'https://random.dog/32367-2062-4347.jpg' } ,
106
+ { key : '9' , title : 'folder of great bois' , illustration : < Folder /> }
105
107
] ;
106
108
109
+ function IllustrationContainer ( props ) {
110
+ props = useSlotProps ( props , 'illustration' ) ;
111
+ let { styleProps} = useStyleProps ( props ) ;
112
+ return (
113
+ < div { ...styleProps } >
114
+ { props . children }
115
+ </ div >
116
+ ) ;
117
+ }
118
+
119
+ function Folder ( ) {
120
+ return (
121
+ < IllustrationContainer >
122
+ < svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 95.23 67" height = "110" >
123
+ < path fill = "var(--spectrum-global-color-gray-600)" d = "M94.47,27a4.45,4.45,0,0,0-3.72-2H20.34a5.45,5.45,0,0,0-5.05,3.37L3.12,57.68V3.88A.89.89,0,0,1,4,3H23.21a2.51,2.51,0,0,1,1.69.66l9.7,8.94a1.56,1.56,0,0,0,1,.4h40a1.5,1.5,0,0,1,1.5,1.5v6a1.5,1.5,0,0,0,3,0v-6a4.51,4.51,0,0,0-4.5-4.5H36.21L26.93,1.46A5.48,5.48,0,0,0,23.21,0H4A3.88,3.88,0,0,0,.12,3.88v61h0A1.51,1.51,0,0,0,1.5,67H79a1.49,1.49,0,0,0,1.38-.92L94.89,31.19A4.45,4.45,0,0,0,94.47,27ZM92.12,30,78,64H3.75L18.06,29.52A2.46,2.46,0,0,1,20.34,28H90.75a1.48,1.48,0,0,1,1.37,2Z" />
124
+ </ svg >
125
+ </ IllustrationContainer >
126
+ ) ;
127
+ }
128
+
107
129
function renderEmptyState ( ) {
108
130
return (
109
131
< IllustratedMessage >
@@ -220,7 +242,14 @@ storiesOf('ListView', module)
220
242
. add ( 'with emphasized ActionBar' , args => < ActionBarExample isEmphasized { ...args } /> )
221
243
. add ( 'thumbnails' , args => (
222
244
< ListView width = "250px" items = { itemsWithThumbs } aria-label = "ListView with thumbnails" { ...args } >
223
- { ( item : any ) => < Item textValue = { item . title } > < Image src = { item . url } alt = "" /> < Text > { item . title } </ Text > < Text slot = "description" > JPG</ Text > </ Item > }
245
+ { ( item : any ) => (
246
+ < Item textValue = { item . title } >
247
+ { item . url && < Image src = { item . url } alt = "" /> }
248
+ { item . illustration }
249
+ < Text > { item . title } </ Text >
250
+ { item . url && < Text slot = "description" > JPG</ Text > }
251
+ </ Item >
252
+ ) }
224
253
</ ListView >
225
254
) )
226
255
. add ( 'long text' , args => (
0 commit comments