88 useInfinitePaginationContext ,
99 TestMemoryRouter ,
1010} from 'ra-core' ;
11- import { Box , Button , Card , Typography } from '@mui/material' ;
11+ import { Box , Button , Card , ThemeOptions , Typography } from '@mui/material' ;
1212
1313import { InfiniteList } from './InfiniteList' ;
1414import { SimpleList } from './SimpleList' ;
@@ -24,6 +24,8 @@ import { SearchInput } from '../input';
2424import { BulkDeleteButton , SelectAllButton , SortButton } from '../button' ;
2525import { TopToolbar , Layout } from '../layout' ;
2626import { BulkActionsToolbar } from './BulkActionsToolbar' ;
27+ import { deepmerge } from '@mui/utils' ;
28+ import { defaultLightTheme } from '../theme' ;
2729
2830export default {
2931 title : 'ra-ui-materialui/list/InfiniteList' ,
@@ -89,11 +91,12 @@ const dataProvider = fakeRestProvider(
8991 500
9092) ;
9193
92- const Admin = ( { children, dataProvider, layout } : any ) => (
94+ const Admin = ( { children, dataProvider, layout, ... props } : any ) => (
9395 < TestMemoryRouter >
9496 < AdminContext
9597 dataProvider = { dataProvider }
9698 i18nProvider = { polyglotI18nProvider ( ( ) => defaultMessages , 'en' ) }
99+ { ...props }
97100 >
98101 < AdminUI layout = { layout } > { children } </ AdminUI >
99102 </ AdminContext >
@@ -437,3 +440,31 @@ export const PartialPagination = () => (
437440 />
438441 </ Admin >
439442) ;
443+
444+ export const Themed = ( ) => (
445+ < Admin
446+ dataProvider = { dataProvider }
447+ theme = { deepmerge ( defaultLightTheme , {
448+ components : {
449+ RaInfiniteList : {
450+ defaultProps : {
451+ className : 'custom-class' ,
452+ perPage : 5 ,
453+ } ,
454+ } ,
455+ } ,
456+ } as ThemeOptions ) }
457+ >
458+ < Resource
459+ name = "books"
460+ list = { ( ) => (
461+ < InfiniteList data-testid = { 'themed-list' } >
462+ < SimpleList
463+ primaryText = "%{title}"
464+ secondaryText = "%{author}"
465+ />
466+ </ InfiniteList >
467+ ) }
468+ />
469+ </ Admin >
470+ ) ;
0 commit comments