mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-07 07:26:46 +00:00
next主题,分类标签数量设置
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
|
import { siteConfig } from '@/lib/config'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
const CategoryGroup = ({ currentCategory, categories }) => {
|
const CategoryGroup = ({ currentCategory, categories }) => {
|
||||||
if (!categories) return <></>
|
if (!categories || categories.length === 0) return <></>
|
||||||
|
const categoryCount = siteConfig('PREVIEW_CATEGORY_COUNT')
|
||||||
|
const categoryOptions = categories.slice(0, categoryCount)
|
||||||
return <>
|
return <>
|
||||||
<div id='category-list' className='dark:border-gray-600 flex flex-wrap'>
|
<div id='category-list' className='dark:border-gray-600 flex flex-wrap'>
|
||||||
{categories.map(category => {
|
{categoryOptions.map(category => {
|
||||||
const selected = currentCategory === category.name
|
const selected = currentCategory === category.name
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { siteConfig } from '@/lib/config'
|
||||||
import TagItemMini from './TagItemMini'
|
import TagItemMini from './TagItemMini'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8,11 +9,14 @@ import TagItemMini from './TagItemMini'
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
const TagGroups = ({ tags, currentTag }) => {
|
const TagGroups = ({ tags, currentTag }) => {
|
||||||
if (!tags) return <></>
|
if (!tags || tags.length === 0) return <></>
|
||||||
|
|
||||||
|
const tagsCount = siteConfig('PREVIEW_TAG_COUNT')
|
||||||
|
const tagOptions = tags.slice(0, tagsCount)
|
||||||
return (
|
return (
|
||||||
<div id='tags-group' className='dark:border-gray-600 w-66 space-y-2'>
|
<div id='tags-group' className='dark:border-gray-600 w-66 space-y-2'>
|
||||||
{
|
{
|
||||||
tags.map(tag => {
|
tagOptions.map(tag => {
|
||||||
const selected = tag.name === currentTag
|
const selected = tag.name === currentTag
|
||||||
return <TagItemMini key={tag.name} tag={tag} selected={selected} />
|
return <TagItemMini key={tag.name} tag={tag} selected={selected} />
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user