forked from tangly1024/NotionNext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4c9f2c
commit 5afd44e
Showing
2 changed files
with
37 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
import { useGlobal } from '@/lib/global' | ||
import CategoryItem from './CategoryItem' | ||
|
||
/** | ||
* 分类 | ||
* @param {*} param0 | ||
* @returns | ||
*/ | ||
const CategoryGroup = ({ currentCategory, categoryOptions }) => { | ||
const { locale } = useGlobal() | ||
if (!categoryOptions) { | ||
return <></> | ||
} | ||
return <div id='category-list' className='pt-4'> | ||
<div className='mb-2'><i className='mr-2 fas fa-th' />分类</div> | ||
<div className='flex flex-wrap'> | ||
{categoryOptions?.map(category => { | ||
const selected = currentCategory === category.name | ||
return <CategoryItem key={category.name} selected={selected} category={category.name} categoryCount={category.count} /> | ||
})} | ||
return ( | ||
<div id='category-list' className='pt-4'> | ||
<div className='mb-2'> | ||
<i className='mr-2 fas fa-th' /> | ||
{locale.COMMON.CATEGORY} | ||
</div> | ||
<div className='flex flex-wrap'> | ||
{categoryOptions?.map(category => { | ||
const selected = currentCategory === category.name | ||
return ( | ||
<CategoryItem | ||
key={category.name} | ||
selected={selected} | ||
category={category.name} | ||
categoryCount={category.count} | ||
/> | ||
) | ||
})} | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CategoryGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters