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