Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Add questionnaire pages for each life event and breadcrumb nav #6

Merged
merged 3 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions components/Breadcrumb.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<template>
<nav v-if="$route.fullPath !=='/'" class="usa-breadcrumb" aria-label="Breadcrumbs,,">
<ol class="usa-breadcrumb__list"
vocab="http://schema.org/"
typeof="BreadcrumbList">
<li class="usa-breadcrumb__list-item"
property="itemListElement" typeof="ListItem">
<nuxt-link class="usa-breadcrumb__link" property="item" typeof="WebPage"
to="/">
<span property="name">Home</span>
</nuxt-link>
<meta property="position" content="1" />
</li>
<li v-for="(crumb, index) in crumbs"
:key="index"
class="usa-breadcrumb__list-item"
property="itemListElement"
typeof="ListItem">
<template v-if="$route.fullPath === crumb.path">
<span property="name">{{
$route.fullPath === crumb.path && title !== null ? title : crumb.title
}}</span>
</template>
<template v-else>
<nuxt-link class="usa-breadcrumb__link" property="item" typeof="WebPage"
:to="crumb.path">
<span property="name">{{
$route.fullPath === crumb.path && title !== null ? title : crumb.title
}}</span>
</nuxt-link>
<meta property="position" :content="index + 2" />
</template>
</li>
</ol>
</nav>
</template>

<script>

const _ = require('lodash');

export default {
props: {
title: {
type: String,
default: null,
},
},
computed: {
crumbs () {
const fullPath = _.escapeRegExp(this.$route.fullPath);
const segments = fullPath.substring(1).split('/');
const crumbs = [];
let path = '';
segments.forEach((segment, index) => {
path = `${path}/${segment}`;
const match = this.$router.match(path);
crumbs.push({
title: _.startCase(segment),
...match,
});
});
return crumbs;
},
},
}
</script>
7 changes: 7 additions & 0 deletions components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@
</div>
</nav>
</header>
<div class="grid-container">
<div class="grid-row">
<div class="grid-col margin-top-2">
<Breadcrumb />
</div>
</div>
</div>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/components/**/*.vue',
'<rootDir>/pages/**/*.vue'
'<rootDir>/pages/**/*.vue',
],
coverageThreshold: {
global: {
Expand Down
2 changes: 1 addition & 1 deletion layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script>
export default {
head: {
script: [{ src: "./assets/js/uswds-init.min.js" }]
script: [{ src: "/assets/js/uswds-init.min.js" }]
}
};
</script>
Expand Down
Loading