123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import ImageList from '@mui/material/ImageList';
- import { makeStyles } from '@material-ui/core'
- import MediaListItem from './MediaListItem';
- import AlertInfo from '../../../../reusableComponents/AlertInfo';
- import { TAllMessages } from '../../../../../typescript/redux/allMessages/types'
- const useStyles = makeStyles({
- container: {
- width: '100%',
- maxHeight: '88vh',
- overflowY: 'scroll',
- position: 'absolute',
- animationDuration: '0.2s',
- animationDirection: 'normal',
- animation: `$moveElement`,
- '&::-webkit-scrollbar': {
- width: '0.4em'
- },
- '&::-webkit-scrollbar-track': {
- boxShadow: 'inset 0 0 6px rgba(0,0,0,0.00)',
- webkitBoxShadow: 'inset 0 0 6px rgba(0,0,0,0.00)',
- backgroundColor: '#eceeec',
- },
- '&::-webkit-scrollbar-thumb': {
- backgroundColor: '#ccc8c8',
- },
- "&::-webkit-scrollbar-thumb:focus": {
- backgroundColor: "#959595",
- },
- "&::-webkit-scrollbar-thumb:active": {
- backgroundColor: "#959595",
- },
- },
- '@keyframes moveElement': {
- '0%': { left: '-100%'},
- '100%': { left: '0%'},
- },
- })
- interface IMediaList {
- filteredAndSortedMessages: TAllMessages,
- value: string,
- date: any,
- handleScrollToTheMessage:(_id:string,companionId:string) => void
- }
- const MediaList = ({ filteredAndSortedMessages,value,date,handleScrollToTheMessage }: IMediaList) => {
- const classes = useStyles()
-
- return (
- <>
- {filteredAndSortedMessages.length > 0 &&
- <ImageList className={classes.container} cols={3} rowHeight={164}>
- {filteredAndSortedMessages.map(({message,createdAt,fullType,updatedAt,_id,companionId,name,lastName,color}) =>
- <MediaListItem key={createdAt} message={message} fullType={fullType}
- updatedAt={updatedAt} handleScrollToTheMessage={handleScrollToTheMessage} id={_id}
- companionId={companionId} name={name} lastName={lastName} color={color}/>)}
- </ImageList>}
- {(value || date) && filteredAndSortedMessages.length === 0 && <AlertInfo name={`Can not find Media by request: ${value}`} />}
- {!value && !date && filteredAndSortedMessages.length === 0 && <AlertInfo name='You do not have Media yet!'/>}
- </>
- )
- }
- export default MediaList
|