修复搜索页分类标签丢失

This commit is contained in:
tangly1024.com
2023-02-08 15:12:34 +08:00
parent 1678caee9a
commit ad912e62b1
6 changed files with 16 additions and 14 deletions

View File

@@ -1,14 +1,14 @@
import React from 'react'
import CategoryItem from './CategoryItem'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) {
const CategoryGroup = ({ currentCategory, categoryOptions }) => {
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'>
{categories?.map(category => {
{categoryOptions?.map(category => {
const selected = currentCategory === category.name
return <CategoryItem key={category.name} selected={selected} category={category.name} categoryCount={category.count} />
})}

View File

@@ -7,14 +7,14 @@ import TagItemMini from './TagItemMini'
* @returns {JSX.Element}
* @constructor
*/
const TagGroups = ({ tags, currentTag }) => {
if (!tags) return <></>
const TagGroups = ({ tagOptions, currentTag }) => {
if (!tagOptions) return <></>
return (
<div id='tags-group' className='dark:border-gray-600 py-4'>
<div className='mb-2'><i className='mr-2 fas fa-tag' />标签</div>
<div className='space-y-2'>
{
tags?.map(tag => {
tagOptions?.map(tag => {
const selected = tag.name === currentTag
return <TagItemMini key={tag.name} tag={tag} selected={selected} />
})