This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
2021-12-28 21:55:32 +01:00

31 lines
787 B
TypeScript

import InfiniteScroll from 'react-infinite-scroll-component'
import { GuildsChannelsPath } from '../Application'
import { Loader } from 'components/design/Loader'
import { Channel } from './Channel'
import { useChannels } from 'contexts/Channels'
export interface ChannelsProps {
path: GuildsChannelsPath
}
export const Channels: React.FC<ChannelsProps> = (props) => {
const { path } = props
const { channels, hasMore, nextPage } = useChannels()
return (
<InfiniteScroll
className='w-full channels-list'
dataLength={channels.length}
next={nextPage}
hasMore={hasMore}
loader={<Loader />}
>
{channels.map((channel) => {
return <Channel key={channel.id} channel={channel} path={path} />
})}
</InfiniteScroll>
)
}