import React from 'react' import { useSelector } from 'react-redux' import { AutocompleteInput, Filter, List, NullableBooleanInput, NumberInput, ReferenceInput, SearchInput, Pagination } from 'react-admin' import { Title } from '../common' import { withWidth } from '@material-ui/core' import AlbumListActions from './AlbumListActions' import AlbumListView from './AlbumListView' import AlbumGridView from './AlbumGridView' import { ALBUM_MODE_LIST } from './albumState' const AlbumFilter = (props) => ( ({ name: [searchText] })} > ) const getPerPage = (width) => { if (width === 'xs') return 12 if (width === 'sm') return 12 if (width === 'md') return 15 if (width === 'lg') return 18 return 21 } const getPerPageOptions = (width) => { const options = [3, 6, 12] if (width === 'xs') return [12] if (width === 'sm') return [12] if (width === 'md') return options.map((v) => v * 5) if (width === 'lg') return options.map((v) => v * 6) return options.map((v) => v * 7) } const AlbumList = (props) => { const { width } = props const albumView = useSelector((state) => state.albumView) return ( } exporter={false} bulkActionButtons={false} actions={} filters={} perPage={getPerPage(width)} pagination={} > {albumView.mode === ALBUM_MODE_LIST ? ( ) : ( )} ) } export default withWidth()(AlbumList)