Skip to content

Commit

Permalink
fix enhancement_410_page_blog
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderMorugin committed Jun 21, 2024
1 parent 8e8a2d9 commit 0986e7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
12 changes: 6 additions & 6 deletions src/entities/BlogCategories/ui/BlogCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface IBlogCategories {
*/

const BlogCategories: FC<IBlogCategories> = ({ cards, filterItems }) => {
const cat = useMemo(
const currentCategory = useMemo(
() =>
cards.map(item => {
return item.category
Expand All @@ -33,19 +33,19 @@ const BlogCategories: FC<IBlogCategories> = ({ cards, filterItems }) => {
}[] = []
// Create a unique list of items to loop over
// Add each item to the result list
;[...new Set(cat)].forEach(item =>
;[...new Set(currentCategory)].forEach(item =>
useMemo(
() =>
result.push({
key: item,
// Get the count of items of the current type
count: cat.filter(i => i == item).length
count: currentCategory.filter(i => i == item).length
}),
[result]
)
)

const uniqueCats = useMemo(
const Categories = useMemo(
() =>
result.map(item => {
return (
Expand All @@ -61,7 +61,7 @@ const BlogCategories: FC<IBlogCategories> = ({ cards, filterItems }) => {
</li>
)
}),
[[...new Set(cat)]]
[currentCategory]
)

return (
Expand All @@ -70,7 +70,7 @@ const BlogCategories: FC<IBlogCategories> = ({ cards, filterItems }) => {
Категории
</Heading>
<Scroll withManualGrip={true} className={styles.blogCategories__list}>
{uniqueCats}
{Categories}
</Scroll>
</div>
)
Expand Down
28 changes: 0 additions & 28 deletions src/models/PropsBlog.ts

This file was deleted.

0 comments on commit 0986e7d

Please sign in to comment.