Skip to content

Commit ed24389

Browse files
committed
improve the story to display every possibility of ListGuesser
1 parent 92b2967 commit ed24389

File tree

1 file changed

+95
-22
lines changed

1 file changed

+95
-22
lines changed

packages/ra-ui-materialui/src/list/ListGuesser.stories.tsx

Lines changed: 95 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,58 +21,129 @@ const data = {
2121
price: 45.99,
2222
category_id: 1,
2323
tags_ids: [1],
24+
last_update: new Date('2023-10-01').toISOString(),
25+
2426
},
2527
{
2628
id: 2,
2729
name: 'Black elegance jeans',
2830
price: 69.99,
2931
category_id: 1,
3032
tags_ids: [2, 3],
33+
last_update: new Date('2023-11-01').toISOString(),
34+
3135
},
3236
{
3337
id: 3,
3438
name: 'Slim fit jeans',
3539
price: 55.99,
3640
category_id: 1,
3741
tags_ids: [2, 4],
42+
last_update: new Date('2023-12-01').toISOString(),
43+
3844
},
3945
{
4046
id: 4,
4147
name: 'Basic T-shirt',
4248
price: 15.99,
4349
category_id: 2,
4450
tags_ids: [1, 4, 3],
51+
last_update: new Date('2023-10-15').toISOString(),
52+
4553
},
4654
{
4755
id: 5,
4856
name: 'Basic cap',
4957
price: 19.99,
5058
category_id: 6,
5159
tags_ids: [1, 4, 3],
60+
last_update: new Date('2023-10-15').toISOString(),
61+
5262
},
5363
],
5464
categories: [
55-
{ id: 1, name: 'Jeans' },
56-
{ id: 2, name: 'T-Shirts' },
57-
{ id: 3, name: 'Jackets' },
58-
{ id: 4, name: 'Shoes' },
59-
{ id: 5, name: 'Accessories' },
60-
{ id: 6, name: 'Hats' },
61-
{ id: 7, name: 'Socks' },
62-
{ id: 8, name: 'Shirts' },
63-
{ id: 9, name: 'Sweaters' },
64-
{ id: 10, name: 'Trousers' },
65-
{ id: 11, name: 'Coats' },
66-
{ id: 12, name: 'Dresses' },
67-
{ id: 13, name: 'Skirts' },
68-
{ id: 14, name: 'Swimwear' },
69-
{ id: 15, name: 'Bags' },
65+
{
66+
id: 1,
67+
name: 'Jeans',
68+
alternativeName: [{ name: 'denims' }, { name: 'pants' }],
69+
isVeganProduction: true,
70+
},
71+
{
72+
id: 2,
73+
name: 'T-Shirts',
74+
alternativeName: [{ name: 'polo' }, { name: 'tee shirt' }],
75+
isVeganProduction: false,
76+
},
77+
{
78+
id: 3,
79+
name: 'Jackets',
80+
alternativeName: [{ name: 'coat' }, { name: 'blazers' }],
81+
isVeganProduction: false,
82+
},
83+
{
84+
id: 4,
85+
name: 'Shoes',
86+
alternativeName: [{ name: 'sneakers' }, { name: 'moccasins' }],
87+
isVeganProduction: false,
88+
},
89+
{
90+
id: 5,
91+
name: 'Accessories',
92+
alternativeName: [{ name: 'jewelry' }, { name: 'belts' }],
93+
isVeganProduction: true,
94+
},
95+
{
96+
id: 6,
97+
name: 'Hats',
98+
alternativeName: [{ name: 'caps' }, { name: 'headwear' }],
99+
isVeganProduction: true,
100+
},
101+
{
102+
id: 7,
103+
name: 'Socks',
104+
alternativeName: [{ name: 'stockings' }, { name: 'hosiery' }],
105+
isVeganProduction: false,
106+
},
107+
{
108+
id: 8,
109+
name: 'Bags',
110+
alternativeName: [{ name: 'handbags' }, { name: 'purses' }],
111+
isVeganProduction: false,
112+
},
113+
{
114+
id: 9,
115+
name: 'Dresses',
116+
alternativeName: [{ name: 'robes' }, { name: 'gowns' }],
117+
isVeganProduction: false,
118+
},
119+
{
120+
id: 10,
121+
name: 'Skirts',
122+
alternativeName: [{ name: 'tutus' }, { name: 'kilts' }],
123+
isVeganProduction: false,
124+
},
70125
],
71126
tags: [
72-
{ id: 1, name: 'top seller' },
73-
{ id: 2, name: 'new' },
74-
{ id: 3, name: 'sale' },
75-
{ id: 4, name: 'promotion' },
127+
{
128+
id: 1,
129+
name: 'top seller',
130+
url: 'https://www.myshop.com/tags/top-seller',
131+
},
132+
{
133+
id: 2,
134+
name: 'new',
135+
url: 'https://www.myshop.com/tags/new',
136+
},
137+
{
138+
id: 3,
139+
name: 'sale',
140+
url: 'https://www.myshop.com/tags/sale',
141+
},
142+
{
143+
id: 4,
144+
name: 'promotion',
145+
url: 'https://www.myshop.com/tags/promotion',
146+
},
76147
],
77148
};
78149

@@ -119,6 +190,8 @@ const delayedDataProvider = fakeRestProvider(
119190
300
120191
);
121192

193+
const ListGuesserWithProdLogs = props => <ListGuesser {...props} enableLog />;
194+
122195
export const ManyResources = () => (
123196
<AdminContext
124197
dataProvider={delayedDataProvider}
@@ -127,17 +200,17 @@ export const ManyResources = () => (
127200
<AdminUI>
128201
<Resource
129202
name="products"
130-
list={ListGuesser}
203+
list={ListGuesserWithProdLogs}
131204
recordRepresentation="name"
132205
/>
133206
<Resource
134207
name="categories"
135-
list={ListGuesser}
208+
list={ListGuesserWithProdLogs}
136209
recordRepresentation="name"
137210
/>
138211
<Resource
139212
name="tags"
140-
list={ListGuesser}
213+
list={ListGuesserWithProdLogs}
141214
recordRepresentation="name"
142215
/>
143216
</AdminUI>

0 commit comments

Comments
 (0)