1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
<template>
<div id="navbar">
<nav class="navbar">
<div class="navbar-container">
<div class="nav">
<ul>
<li
v-for="(item, index) in nav_items" :key="index">
<router-link
class="nav-link fs-4" :class="{ active: activePage === item }"
:aria-current="(activePage === item) ? 'page' : ''" :to="'/' + repository + '/' + item">
{{ item }}
</router-link>
</li>
<li id="clone-dropdown">
<RepositoryCloneDropdown :repository="repository" class="d-block" />
</li>
</ul>
</div>
</div>
</nav>
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import RepositoryCloneDropdown from "../components/RepositoryCloneDropdown.vue";
export default defineComponent({
name: "RepositoryNavbar",
props: {
repository: {
type: String,
required: true
},
activePage: {
type: String,
required: true
},
hasReadme: {
type: Boolean,
required: true
}
},
components: {
RepositoryCloneDropdown
},
data() {
return {
nav_items: [ "log", "refs", "tree" ]
};
},
watch: {
hasReadme() {
this.nav_items = [ "about" ].concat(this.nav_items);
}
}
});
</script>
<style lang="scss" scoped>
@use "../scss/colors";
#navbar {
margin-left: 3rem;
}
.navbar {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
flex-wrap: nowrap;
justify-content: flex-start;
.navbar-container {
display: flex;
flex-wrap: inherit;
align-items: center;
justify-content: space-between;
width: 100%;
.nav {
display: flex;
flex-basis: auto;
flex-grow: 1;
align-items: center;
ul {
display: flex;
flex-direction: row;
padding-left: 0;
margin-bottom: 0;
list-style: none;
align-items: center;
flex: 1 1 auto;
.nav-link {
color: darken(#ffffff, 50%);
padding-right: 0.5rem;
padding-left: 0.5rem;
transition: color .15s ease-in-out;
&:hover {
color: darken(#ffffff, 20%);
}
}
#clone-dropdown {
margin-left: auto;
margin-right: 40px;
}
.active {
color: darken(#ffffff, 20%);
}
}
}
}
}
</style>
|