index.tsx 939 B

1234567891011121314151617181920212223
  1. import ImageList from '@mui/material/ImageList';
  2. import MediaListItem from './MediaListItem';
  3. import AlertInfo from '../../../../../reusableComponents/AlertInfo';
  4. import { TMessages } from '../../../../../../typescript/redux/messages/types'
  5. interface IMediaList {
  6. filteredAndSorted: TMessages,
  7. handleScrollToTheMessage: (_id:string) => void,
  8. }
  9. const MediaList = ({ filteredAndSorted,handleScrollToTheMessage }: IMediaList) => {
  10. return filteredAndSorted.length > 0 ?(
  11. <ImageList sx={{ width: '100%', height: 'auto',overflow:'hidden' }} cols={3} rowHeight={164}>
  12. {filteredAndSorted.map(({message,createdAt,fullType,updatedAt,_id}) =>
  13. <MediaListItem key={createdAt} message={message} fullType={fullType}
  14. updatedAt={updatedAt} handleScrollToTheMessage={handleScrollToTheMessage} id={_id} />)}
  15. </ImageList>
  16. ): <AlertInfo name='You do not have Media yet!'/>
  17. }
  18. export default MediaList