Skip to content

Commit 51ec8e6

Browse files
authored
Merge pull request tangly1024#2607 from tangly1024/fix/theme-medium-lang
fix medium lang
2 parents d4c9f2c + 5afd44e commit 51ec8e6

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed
+27-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1+
import { useGlobal } from '@/lib/global'
12
import CategoryItem from './CategoryItem'
23

4+
/**
5+
* 分类
6+
* @param {*} param0
7+
* @returns
8+
*/
39
const CategoryGroup = ({ currentCategory, categoryOptions }) => {
10+
const { locale } = useGlobal()
411
if (!categoryOptions) {
512
return <></>
613
}
7-
return <div id='category-list' className='pt-4'>
8-
<div className='mb-2'><i className='mr-2 fas fa-th' />分类</div>
9-
<div className='flex flex-wrap'>
10-
{categoryOptions?.map(category => {
11-
const selected = currentCategory === category.name
12-
return <CategoryItem key={category.name} selected={selected} category={category.name} categoryCount={category.count} />
13-
})}
14+
return (
15+
<div id='category-list' className='pt-4'>
16+
<div className='mb-2'>
17+
<i className='mr-2 fas fa-th' />
18+
{locale.COMMON.CATEGORY}
19+
</div>
20+
<div className='flex flex-wrap'>
21+
{categoryOptions?.map(category => {
22+
const selected = currentCategory === category.name
23+
return (
24+
<CategoryItem
25+
key={category.name}
26+
selected={selected}
27+
category={category.name}
28+
categoryCount={category.count}
29+
/>
30+
)
31+
})}
32+
</div>
1433
</div>
15-
</div>
34+
)
1635
}
1736

1837
export default CategoryGroup

themes/medium/components/TagGroups.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useGlobal } from '@/lib/global'
12
import TagItemMini from './TagItemMini'
23

34
/**
@@ -8,17 +9,19 @@ import TagItemMini from './TagItemMini'
89
* @constructor
910
*/
1011
const TagGroups = ({ tagOptions, currentTag }) => {
12+
const { locale } = useGlobal()
1113
if (!tagOptions) return <></>
1214
return (
1315
<div id='tags-group' className='dark:border-gray-600 py-4'>
14-
<div className='mb-2'><i className='mr-2 fas fa-tag' />标签</div>
16+
<div className='mb-2'>
17+
<i className='mr-2 fas fa-tag' />
18+
{locale.COMMON.TAGS}
19+
</div>
1520
<div className='space-y-2'>
16-
{
17-
tagOptions?.map(tag => {
18-
const selected = tag.name === currentTag
19-
return <TagItemMini key={tag.name} tag={tag} selected={selected} />
20-
})
21-
}
21+
{tagOptions?.map(tag => {
22+
const selected = tag.name === currentTag
23+
return <TagItemMini key={tag.name} tag={tag} selected={selected} />
24+
})}
2225
</div>
2326
</div>
2427
)

0 commit comments

Comments
 (0)