Skip to content

Commit 62de573

Browse files
committed
feat: add story for List with slots
1 parent 4b0b2d9 commit 62de573

File tree

1 file changed

+54
-11
lines changed

1 file changed

+54
-11
lines changed

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

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import * as React from 'react';
2-
import { Admin, AutocompleteInput } from 'react-admin';
1+
import { Box, Button, Card, Link as MuiLink, Typography } from '@mui/material';
32
import {
43
CustomRoutes,
4+
DataProvider,
55
Resource,
6-
useListContext,
76
TestMemoryRouter,
8-
DataProvider,
7+
useListContext,
98
} from 'ra-core';
109
import fakeRestDataProvider from 'ra-data-fakerest';
11-
import { Box, Card, Typography, Button, Link as MuiLink } from '@mui/material';
10+
import * as React from 'react';
11+
import { Admin, AutocompleteInput } from 'react-admin';
1212

13-
import { List } from './List';
14-
import { SimpleList } from './SimpleList';
15-
import { ListActions } from './ListActions';
16-
import { Datagrid } from './datagrid';
17-
import { TextField } from '../field';
18-
import { SearchInput, TextInput } from '../input';
1913
import { Route } from 'react-router';
2014
import { Link } from 'react-router-dom';
2115
import { BulkDeleteButton, ListButton, SelectAllButton } from '../button';
2216
import { ShowGuesser } from '../detail';
17+
import { TextField } from '../field';
18+
import { SearchInput, TextInput } from '../input';
2319
import TopToolbar from '../layout/TopToolbar';
2420
import { BulkActionsToolbar } from './BulkActionsToolbar';
21+
import { List } from './List';
22+
import { ListActions } from './ListActions';
23+
import { SimpleList } from './SimpleList';
24+
import { Datagrid } from './datagrid';
2525

2626
export default { title: 'ra-ui-materialui/list/List' };
2727

@@ -801,3 +801,46 @@ export const ResponseMetadata = () => (
801801
</Admin>
802802
</TestMemoryRouter>
803803
);
804+
805+
export const slots = () => (
806+
<TestMemoryRouter initialEntries={['/books']}>
807+
<Admin dataProvider={defaultDataProvider}>
808+
<Resource
809+
name="books"
810+
list={() => (
811+
<List
812+
slots={{
813+
actions: (
814+
<Box sx={{ backgroundColor: 'info.main' }}>
815+
Actions
816+
</Box>
817+
),
818+
aside: (
819+
<Box sx={{ backgroundColor: 'info.main' }}>
820+
Aside
821+
</Box>
822+
),
823+
filters: (
824+
<Box sx={{ backgroundColor: 'info.main' }}>
825+
Filter
826+
</Box>
827+
),
828+
pagination: (
829+
<Box sx={{ backgroundColor: 'info.main' }}>
830+
List
831+
</Box>
832+
),
833+
empty: (
834+
<Box sx={{ backgroundColor: 'info.main' }}>
835+
Empty
836+
</Box>
837+
),
838+
}}
839+
>
840+
<BookList />
841+
</List>
842+
)}
843+
/>
844+
</Admin>
845+
</TestMemoryRouter>
846+
);

0 commit comments

Comments
 (0)