mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
修复搜索页分类标签丢失
This commit is contained in:
@@ -36,6 +36,8 @@ const Search = props => {
|
||||
const { theme } = useGlobal()
|
||||
const ThemeComponents = ThemeMap[theme]
|
||||
|
||||
console.log('search', props)
|
||||
|
||||
return (
|
||||
<ThemeComponents.LayoutSearch
|
||||
{...props}
|
||||
|
||||
@@ -22,10 +22,10 @@ function GroupCategory ({ currentCategory, categories }) {
|
||||
|
||||
<i className={`${selected ? 'text-white fa-folder-open' : 'fa-folder text-gray-400'} fas mr-2`} />{category.name}({category.count})
|
||||
</Link>
|
||||
);
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</>;
|
||||
</>
|
||||
}
|
||||
|
||||
export default GroupCategory
|
||||
|
||||
@@ -12,7 +12,7 @@ import Card from './components/Card'
|
||||
import Link from 'next/link'
|
||||
|
||||
export const LayoutSearch = props => {
|
||||
const { keyword, tags, categories } = props
|
||||
const { keyword, tagOptions, categoryOptions } = props
|
||||
const { locale } = useGlobal()
|
||||
const router = useRouter()
|
||||
const currentSearch = keyword || router?.query?.s
|
||||
@@ -49,7 +49,7 @@ export const LayoutSearch = props => {
|
||||
{locale.COMMON.CATEGORY}:
|
||||
</div>
|
||||
<div id="category-list" className="duration-200 flex flex-wrap mx-8">
|
||||
{categories?.map(category => {
|
||||
{categoryOptions?.map(category => {
|
||||
return (
|
||||
<Link
|
||||
key={category.name}
|
||||
@@ -76,7 +76,7 @@ export const LayoutSearch = props => {
|
||||
{locale.COMMON.TAGS}:
|
||||
</div>
|
||||
<div id="tags-list" className="duration-200 flex flex-wrap ml-8">
|
||||
{tags?.map(tag => {
|
||||
{tagOptions?.map(tag => {
|
||||
return (
|
||||
<div key={tag.name} className="p-2">
|
||||
<TagItemMini key={tag.name} tag={tag} />
|
||||
|
||||
@@ -12,7 +12,7 @@ import Card from './components/Card'
|
||||
import Link from 'next/link'
|
||||
|
||||
export const LayoutSearch = props => {
|
||||
const { keyword, tags, categories } = props
|
||||
const { keyword, tagOptions, categoryOptions } = props
|
||||
const { locale } = useGlobal()
|
||||
const router = useRouter()
|
||||
const currentSearch = keyword || router?.query?.s
|
||||
@@ -49,7 +49,7 @@ export const LayoutSearch = props => {
|
||||
{locale.COMMON.CATEGORY}:
|
||||
</div>
|
||||
<div id="category-list" className="duration-200 flex flex-wrap mx-8">
|
||||
{categories?.map(category => {
|
||||
{categoryOptions?.map(category => {
|
||||
return (
|
||||
<Link
|
||||
key={category.name}
|
||||
@@ -76,7 +76,7 @@ export const LayoutSearch = props => {
|
||||
{locale.COMMON.TAGS}:
|
||||
</div>
|
||||
<div id="tags-list" className="duration-200 flex flex-wrap ml-8">
|
||||
{tags?.map(tag => {
|
||||
{tagOptions?.map(tag => {
|
||||
return (
|
||||
<div key={tag.name} className="p-2">
|
||||
<TagItemMini key={tag.name} tag={tag} />
|
||||
|
||||
@@ -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} />
|
||||
})}
|
||||
|
||||
@@ -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} />
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user