mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-29 23:16:51 +00:00
配置文件整体重构
This commit is contained in:
@@ -3,28 +3,34 @@ import Link from 'next/link'
|
||||
|
||||
const CategoryGroup = ({ currentCategory, categories }) => {
|
||||
if (!categories || categories.length === 0) return <></>
|
||||
const categoryCount = siteConfig('PREVIEW_CATEGORY_COUNT')
|
||||
const categoryCount = siteConfig('NEXT_PREVIEW_CATEGORY_COUNT')
|
||||
const categoryOptions = categories.slice(0, categoryCount)
|
||||
return <>
|
||||
<div id='category-list' className='dark:border-gray-600 flex flex-wrap'>
|
||||
{categoryOptions.map(category => {
|
||||
const selected = currentCategory === category.name
|
||||
return (
|
||||
<Link
|
||||
key={category.name}
|
||||
href={`/category/${category.name}`}
|
||||
passHref
|
||||
className={(selected
|
||||
? 'hover:text-white dark:hover:text-white bg-gray-600 text-white '
|
||||
: 'dark:text-gray-400 text-gray-500 hover:text-white hover:bg-gray-500 dark:hover:text-white') +
|
||||
' text-sm w-full items-center duration-300 px-2 cursor-pointer py-1 font-light'}>
|
||||
|
||||
<i className={`${selected ? 'text-white fa-folder-open ' : 'text-gray-500 fa-folder '} mr-2 fas`} />{category.name}({category.count})
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</>;
|
||||
return (
|
||||
<>
|
||||
<div id='category-list' className='dark:border-gray-600 flex flex-wrap'>
|
||||
{categoryOptions.map(category => {
|
||||
const selected = currentCategory === category.name
|
||||
return (
|
||||
<Link
|
||||
key={category.name}
|
||||
href={`/category/${category.name}`}
|
||||
passHref
|
||||
className={
|
||||
(selected
|
||||
? 'hover:text-white dark:hover:text-white bg-gray-600 text-white '
|
||||
: 'dark:text-gray-400 text-gray-500 hover:text-white hover:bg-gray-500 dark:hover:text-white') +
|
||||
' text-sm w-full items-center duration-300 px-2 cursor-pointer py-1 font-light'
|
||||
}>
|
||||
<i
|
||||
className={`${selected ? 'text-white fa-folder-open ' : 'text-gray-500 fa-folder '} mr-2 fas`}
|
||||
/>
|
||||
{category.name}({category.count})
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default CategoryGroup
|
||||
|
||||
@@ -11,16 +11,14 @@ import TagItemMini from './TagItemMini'
|
||||
const TagGroups = ({ tags, currentTag }) => {
|
||||
if (!tags || tags.length === 0) return <></>
|
||||
|
||||
const tagsCount = siteConfig('PREVIEW_TAG_COUNT')
|
||||
const tagsCount = siteConfig('NEXT_PREVIEW_TAG_COUNT')
|
||||
const tagOptions = tags.slice(0, tagsCount)
|
||||
return (
|
||||
<div id='tags-group' className='dark:border-gray-600 w-66 space-y-2'>
|
||||
{
|
||||
tagOptions.map(tag => {
|
||||
const selected = tag.name === currentTag
|
||||
return <TagItemMini key={tag.name} tag={tag} selected={selected} />
|
||||
})
|
||||
}
|
||||
{tagOptions.map(tag => {
|
||||
const selected = tag.name === currentTag
|
||||
return <TagItemMini key={tag.name} tag={tag} selected={selected} />
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user