import Masonry from 'react-responsive-masonry'
import { Flex, Text } from 'theme-ui'
import { CardListItem } from '../CardListItem/CardListItem'
import { Icon } from '../Icon/Icon'
import { Loader } from '../Loader/Loader'
import type { ListItem } from '../CardListItem/types'
export interface IProps {
filteredList: ListItem[] | null
list: ListItem[]
}
export const EMPTY_LIST = 'Oh nos! Nothing to show!'
export const CardList = (props: IProps) => {
const { filteredList, list } = props
const listToShow = filteredList === null ? list : filteredList
const displayItems = listToShow
.sort(
(a, b) =>
Date.parse(b.creator?._lastActive || '0') -
Date.parse(a.creator?._lastActive || '0'),
)
.map((item) => )
const isListEmpty = displayItems.length === 0
const hasListLoaded = list
const results = `${displayItems.length} ${
displayItems.length == 1 ? 'result' : 'results'
}`
return (
{!hasListLoaded && }
{hasListLoaded && (
<>
{results}
Most active
{isListEmpty && EMPTY_LIST}
{!isListEmpty && {displayItems}}
>
)}
)
}