diff options
author | HampusM <hampus@hampusmat.com> | 2021-06-03 12:05:43 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-06-03 12:05:43 +0200 |
commit | 0734d4b344f8ff98a00890fa1f3c3995837dea11 (patch) | |
tree | 00456dbcb76f6525009a2d4b203a2a3f58c5e6a9 | |
parent | 371e3f13e0a046aeca3a2895e4a85f8b51059edf (diff) |
Created a breadcrumb component & the tree page has a breadcrumb and a better font size
-rw-r--r-- | src/frontend/components/BaseBreadcrumb.vue | 33 | ||||
-rw-r--r-- | src/frontend/views/RepositoryCommit.vue | 17 | ||||
-rw-r--r-- | src/frontend/views/RepositoryTree.vue | 14 |
3 files changed, 49 insertions, 15 deletions
diff --git a/src/frontend/components/BaseBreadcrumb.vue b/src/frontend/components/BaseBreadcrumb.vue new file mode 100644 index 0000000..df82968 --- /dev/null +++ b/src/frontend/components/BaseBreadcrumb.vue @@ -0,0 +1,33 @@ +<template> + <nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li + v-for="(item, index) in items" class="breadcrumb-item" + :key="index"> + <router-link :to="item.path"> + {{ item.name }} + </router-link> + </li> + <li class="breadcrumb-item active" aria-current="page"> + {{ activeItem }} + </li> + </ol> + </nav> +</template> + + +<script> +export default { + name: "BaseBreadcrumb", + props: { + items: { + type: Array, + required: true + }, + activeItem: { + type: String, + required: true + } + } +}; +</script>
\ No newline at end of file diff --git a/src/frontend/views/RepositoryCommit.vue b/src/frontend/views/RepositoryCommit.vue index f596601..d3ba174 100644 --- a/src/frontend/views/RepositoryCommit.vue +++ b/src/frontend/views/RepositoryCommit.vue @@ -2,18 +2,7 @@ <RepositoryNavbar active-page="log" :repository="repository" /> <div class="row mx-0"> <div class="col ms-2 ps-4 ps-sm-5 fs-5 vld-parent"> - <nav aria-label="breadcrumb"> - <ol class="breadcrumb"> - <li class="breadcrumb-item"> - <router-link :to="'/' + repository + '/log'"> - Log - </router-link> - </li> - <li class="breadcrumb-item active" aria-current="page"> - {{ commit }} - </li> - </ol> - </nav> + <BaseBreadcrumb :items="[{ name: 'Log', path: '/' + repository + '/log' }]" :active-item="commit" /> <Loading v-model:active="is_loading" :height="24" :width="24" color="#ffffff" @@ -52,6 +41,7 @@ <script> import RepositoryNavbar from "../components/RepositoryNavbar"; import CommitPatch from "../components/CommitPatch"; +import BaseBreadcrumb from "../components/BaseBreadcrumb"; import Loading from "vue-loading-overlay"; import 'vue-loading-overlay/dist/vue-loading.css'; import { watch, reactive, toRefs } from "vue"; @@ -62,7 +52,8 @@ export default { components: { RepositoryNavbar, CommitPatch, - Loading + Loading, + BaseBreadcrumb }, props: { repository: { diff --git a/src/frontend/views/RepositoryTree.vue b/src/frontend/views/RepositoryTree.vue index 80a5c3b..dc2c067 100644 --- a/src/frontend/views/RepositoryTree.vue +++ b/src/frontend/views/RepositoryTree.vue @@ -5,7 +5,15 @@ v-model:active="is_loading" :height="24" :width="24" color="#ffffff" :opacity="0" /> - <div class="col ms-4 ps-4 ps-sm-5 mt-3"> + <div class="col ms-4 ps-4 ps-sm-5 mt-3 fs-5"> + <BaseBreadcrumb + :items="[{ name: repository, path: '/' + repository + '/tree' }].concat(pathArr.slice(0, -1).map((path_part, index) => + { + return { + name: path_part, + path: '/' + repository + '/tree/' + pathArr.slice(0, index + 1).join('/') + } + }))" :active-item="pathArr[pathArr.length - 1]" /> <RepositoryTreeTree :repository="repository" :path="path" :tree="tree" v-if="type === 'tree'" /> @@ -20,6 +28,7 @@ import RepositoryNavbar from "../components/RepositoryNavbar"; import RepositoryTreeTree from "../components/RepositoryTreeTree"; import RepositoryTreeBlob from "../components/RepositoryTreeBlob"; +import BaseBreadcrumb from "../components/BaseBreadcrumb"; import Loading from "vue-loading-overlay"; import 'vue-loading-overlay/dist/vue-loading.css'; import { ref } from "vue"; @@ -30,7 +39,8 @@ export default { RepositoryNavbar, Loading, RepositoryTreeTree, - RepositoryTreeBlob + RepositoryTreeBlob, + BaseBreadcrumb }, props: { repository: { |