File tree Expand file tree Collapse file tree 3 files changed +32
-7
lines changed Expand file tree Collapse file tree 3 files changed +32
-7
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
3
<span v-if =" !languages.trim()" >(no languages)</span >
4
- <a
4
+ <router-link
5
5
v-else
6
- href =" #"
7
6
class =" chip"
8
7
v-for =" (language, index) in languagesWithColors"
9
8
:key =" index"
10
9
:style =" { backgroundColor: language.backgroundColor, color: language.textColor }"
10
+ :to =" '/repositories/' + language.text"
11
11
>
12
12
{{ language.text }}
13
- </a >
13
+ </router-link >
14
14
</div >
15
15
</template >
16
16
Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ const routes = [
23
23
name : "PopularRepositories" ,
24
24
component : PopularRepositories
25
25
} ,
26
+ {
27
+ path : ":language" ,
28
+ name : "PopularRepositories" ,
29
+ component : PopularRepositories
30
+ } ,
26
31
{
27
32
path : "new" ,
28
33
name : "NewRepositories" ,
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <h3 class =" center-align" >Popular Repositories</h3 >
3
+ <h3 class =" center-align" >
4
+ Popular <span >{{ language }}</span > Repositories
5
+ </h3 >
4
6
<p class =" center" >
5
- Showing <strong >{{ repositories .length.toLocaleString() }}</strong > repositories
7
+ Showing <strong >{{ filteredLanguageRepositories .length.toLocaleString() }}</strong > repositories
6
8
<span >sorted by stars.</span >
7
9
</p >
8
10
<InputSearch label =" Filter repository by name or description..." v-model =" searchTerm" />
@@ -34,18 +36,28 @@ export default {
34
36
... mapState ({
35
37
repositories : state => state .Repositories .repositories
36
38
}),
39
+ filteredLanguageRepositories () {
40
+ if (this .language ) {
41
+ return this .repositories .filter (item => item .languages .includes (this .language ));
42
+ }
43
+
44
+ return this .repositories ;
45
+ },
37
46
filteredRepositories () {
38
47
if (! this .searchTerm ) {
39
- return this .repositories .slice (0 , 10 );
48
+ return this .filteredLanguageRepositories .slice (0 , 10 );
40
49
}
41
50
42
51
return sortBy (repoSearcher .findAll (this .searchTerm ), repo => - repo .stargazers ).slice (0 , 10 );
52
+ },
53
+ language () {
54
+ return this .$route .params .language || null ;
43
55
}
44
56
},
45
57
watch: {
46
58
repositories: {
47
59
handler () {
48
- repoSearcher .setData (this .repositories );
60
+ repoSearcher .setData (this .filteredLanguageRepositories );
49
61
},
50
62
immediate: true
51
63
}
@@ -58,4 +70,12 @@ span {
58
70
font-style : italic ;
59
71
font-weight : 600 ;
60
72
}
73
+ h3 span {
74
+ text-decoration : underline ;
75
+ font-size : 2.92rem ;
76
+ line-height : 110% ;
77
+ margin : 1.9466666667rem 0 1.168rem 0 ;
78
+ font-style : inherit ;
79
+ font-weight : inherit ;
80
+ }
61
81
</style >
You can’t perform that action at this time.
0 commit comments