File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { siteConfig } from '@/lib/config'
1
2
import Link from 'next/link'
2
3
3
4
const CategoryGroup = ( { currentCategory, categories } ) => {
4
- if ( ! categories ) return < > </ >
5
+ if ( ! categories || categories . length === 0 ) return < > </ >
6
+ const categoryCount = siteConfig ( 'PREVIEW_CATEGORY_COUNT' )
7
+ const categoryOptions = categories . slice ( 0 , categoryCount )
5
8
return < >
6
9
< div id = 'category-list' className = 'dark:border-gray-600 flex flex-wrap' >
7
- { categories . map ( category => {
10
+ { categoryOptions . map ( category => {
8
11
const selected = currentCategory === category . name
9
12
return (
10
13
< Link
Original file line number Diff line number Diff line change
1
+ import { siteConfig } from '@/lib/config'
1
2
import TagItemMini from './TagItemMini'
2
3
3
4
/**
@@ -8,11 +9,14 @@ import TagItemMini from './TagItemMini'
8
9
* @constructor
9
10
*/
10
11
const TagGroups = ( { tags, currentTag } ) => {
11
- if ( ! tags ) return < > </ >
12
+ if ( ! tags || tags . length === 0 ) return < > </ >
13
+
14
+ const tagsCount = siteConfig ( 'PREVIEW_TAG_COUNT' )
15
+ const tagOptions = tags . slice ( 0 , tagsCount )
12
16
return (
13
17
< div id = 'tags-group' className = 'dark:border-gray-600 w-66 space-y-2' >
14
18
{
15
- tags . map ( tag => {
19
+ tagOptions . map ( tag => {
16
20
const selected = tag . name === currentTag
17
21
return < TagItemMini key = { tag . name } tag = { tag } selected = { selected } />
18
22
} )
You can’t perform that action at this time.
0 commit comments