This commit is contained in:
tangly1024.com
2023-02-03 14:03:36 +08:00
parent 80f4656021
commit 94a0d0eabd
6 changed files with 19 additions and 19 deletions

View File

@@ -2,16 +2,16 @@ import Link from 'next/link'
import React from 'react'
import { useGlobal } from '@/lib/global'
const CategoryList = ({ currentCategory, categories }) => {
if (!categories) {
const CategoryList = ({ currentCategory, categoryOptions }) => {
const { locale } = useGlobal()
if (!categoryOptions) {
return <></>
}
const { locale } = useGlobal()
return (
<ul className='flex py-1 space-x-3'>
<li className='w-16 py-2 dark:text-gray-200 whitespace-nowrap'>{locale.COMMON.CATEGORY}</li>
{categories.map(category => {
{categoryOptions.map(category => {
const selected = category.name === currentCategory
return (
<Link
@@ -32,10 +32,10 @@ const CategoryList = ({ currentCategory, categories }) => {
</a>
</li>
</Link>
);
)
})}
</ul>
);
)
}
export default CategoryList

View File

@@ -7,13 +7,13 @@ import TagItem from './TagItem'
* @returns {JSX.Element}
* @constructor
*/
const TagList = ({ tags, currentTag }) => {
if (!tags) {
const TagList = ({ tagOptions, currentTag }) => {
if (!tagOptions) {
return <></>
}
return <ul className='flex py-1 space-x-3'>
<li className='w-20 py-2 dark:text-gray-200 whitespace-nowrap'>标签:</li>
{tags.map(tag => {
{tagOptions.map(tag => {
const selected = tag.name === currentTag
return <TagItem key={tag.name} tag={tag} selected={selected}/>
})}