import { StoriesPreview } from '.' import { UserCategoriesNames, UserCategory, composeUserCategoriesFilters } from '../assets/userCategories' import { useAnnouncements } from '../hooks/api' import { gotError } from '../hooks/useFetch' type CategoryPreviewProps = { category: UserCategory } function CategoryPreview({ category }: CategoryPreviewProps) { const announcements = useAnnouncements(composeUserCategoriesFilters[category]()) return (

{UserCategoriesNames[category]}

{gotError(announcements) ? (

{announcements.error}

) : (announcements.loading ? 'Загрузка...' : )}
) } export default CategoryPreview