import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; import Link from 'soapbox/components/link'; import { Carousel, HStack, Stack, Text } from 'soapbox/components/ui'; import PlaceholderGroupDiscover from 'soapbox/features/placeholder/components/placeholder-group-discover'; import { usePopularGroups } from 'soapbox/hooks/api/usePopularGroups'; import GroupGridItem from './group-grid-item'; const PopularGroups = () => { const { groups, isFetching, isFetched, isError } = usePopularGroups(); const isEmpty = (isFetched && groups.length === 0) || isError; const [groupCover, setGroupCover] = useState(null); return ( {isEmpty ? ( ) : ( {({ width }: { width: number }) => ( <> {isFetching ? ( new Array(4).fill(0).map((_, idx) => (
)) ) : ( groups.map((group) => ( )) )} )}
)}
); }; export default PopularGroups;