File tree Expand file tree Collapse file tree 4 files changed +63
-32
lines changed
components/theme-section-list Expand file tree Collapse file tree 4 files changed +63
-32
lines changed Original file line number Diff line number Diff line change
1
+ <template >
2
+ <uikit-accordion
3
+ :key =" index"
4
+ headerClass =" px-3 py-3 mb-3 bg-editor-primary text-white rounded-sm"
5
+ >
6
+ <div slot =" header" class =" flex items-center" >
7
+ <div class =" capitalize-first" >{{ name }}</div >
8
+ <div class =" ml-2 px-3 bg-white bg-opacity-25 text-xs rounded-full" >
9
+ {{ category.children.length }}
10
+ </div >
11
+ </div >
12
+ <div class =" pt-1" >
13
+ <list-item
14
+ v-for =" section in category.children"
15
+ :key =" section.id"
16
+ :section =" section"
17
+ :insertAfter =" insertAfter"
18
+ />
19
+
20
+ <div
21
+ class =" text-center pt-2 pb-6"
22
+ v-if =" category.children.length === 0"
23
+ >
24
+ {{ $t('themeSectionList.emptyCategory') }}
25
+ </div >
26
+ </div >
27
+ </uikit-accordion >
28
+ </template >
29
+
30
+ <script >
31
+ import ListItem from ' ./list-item.vue'
32
+
33
+ export default {
34
+ name: ' ThemeSectionListCategory' ,
35
+ components: { ListItem },
36
+ props: {
37
+ index: { type: Number , required: true },
38
+ category: { type: Object , required: true },
39
+ insertAfter: { type: String },
40
+ },
41
+ computed: {
42
+ name () {
43
+ return this .$st (` ${ this .currentI18nScope } .categories.${ this .category .id } .name` ) ?? this .category .name
44
+ },
45
+ },
46
+ }
47
+ < / script>
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <uikit-accordion
3
+ <category
4
4
v-for =" (category, index) in categories"
5
- :key =" index"
6
- headerClass =" px-3 py-3 mb-3 bg-editor-primary text-white rounded-sm"
7
- >
8
- <div slot =" header" class =" flex items-center" >
9
- <div class =" capitalize-first" >{{ category.name }}</div >
10
- <div class =" ml-2 px-3 bg-white bg-opacity-25 text-xs rounded-full" >
11
- {{ category.children.length }}
12
- </div >
13
- </div >
14
- <div class =" pt-1" >
15
- <list-item
16
- v-for =" section in category.children"
17
- :key =" section.id"
18
- :section =" section"
19
- :insertAfter =" insertAfter"
20
- />
21
-
22
- <div
23
- class =" text-center pt-2 pb-6"
24
- v-if =" category.children.length === 0"
25
- >
26
- {{ $t('themeSectionList.emptyCategory') }}
27
- </div >
28
- </div >
29
- </uikit-accordion >
5
+ :index =" index"
6
+ :category =" category"
7
+ :insert-after =" insertAfter"
8
+ />
30
9
</div >
31
10
</template >
32
11
33
12
<script >
34
- import ListItem from ' ./list-item .vue'
13
+ import Category from ' ./category .vue'
35
14
36
15
export default {
37
16
name: ' ThemeSectionList' ,
38
- components: { ListItem },
17
+ components: { Category },
39
18
props: {
40
19
insertAfter: { type: String },
41
20
},
42
- data () {
43
- return { activeCategory: null }
44
- },
45
21
computed: {
46
22
categories () {
47
23
return this .services .theme .buildCategories (this .currentTheme )
Original file line number Diff line number Diff line change 30
30
<div
31
31
class =" flex items-center px-2 bg-editor-primary bg-opacity-5 py-4 w-full font-bold text-sm"
32
32
>
33
- <p class =" capitalize-first" >{{ section. name }}</p >
33
+ <p class =" capitalize-first" >{{ name }}</p >
34
34
</div >
35
35
</div >
36
36
</template >
@@ -48,6 +48,13 @@ export default {
48
48
return { hovered: false , isImageLoaded: false , isImageNotFound: false }
49
49
},
50
50
computed: {
51
+ name () {
52
+ return (
53
+ this .$st (
54
+ ` ${ this .currentI18nScope } .sections.${ this .section .id } .name` ,
55
+ ) || this .section .name
56
+ )
57
+ },
51
58
hasScreenshot () {
52
59
return this .section .screenshotPath
53
60
},
Original file line number Diff line number Diff line change 1
1
export const buildCategories = ( theme ) => {
2
2
return theme . sectionCategories . map ( ( category ) => ( {
3
+ id : category . id ,
3
4
name : category . name ,
4
5
children : theme . sections
5
6
. filter ( ( section ) => section . category == category . id )
You can’t perform that action at this time.
0 commit comments