Skip to content

Commit 2439b24

Browse files
committed
Add API header
1 parent 2af0b34 commit 2439b24

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

assets/styles/main.scss

-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ body {
4949
margin: 10px 0;
5050
border-top: none;
5151
width: auto;
52-
display: inline-block;
5352
font-weight: 700;
5453
font-size: 2.3rem;
55-
display: block;
5654
}
5755

5856
.hapi-family-header {

components/api/ApiNav.vue

+8
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ export default {
110110
//Add classes to API nav
111111
let lis = document.querySelectorAll(".api-nav-select-wrapper li");
112112
let code = document.querySelectorAll(".api-nav-select-wrapper code");
113+
let wrapper = document.querySelector(".markdown-wrapper");
114+
let hapiHeader = document.createElement("h1");
115+
hapiHeader.innerHTML =
116+
"API <span class='api-version-span'>v" +
117+
this.version.match(/.*(?=\.)/)[0] +
118+
".x";
119+
hapiHeader.setAttribute("class", "hapi-header");
120+
wrapper.insertBefore(hapiHeader, wrapper.firstChild);
113121
const height = document
114122
.querySelector(".api-nav-select-wrapper")
115123
.getBoundingClientRect().bottom;

pages/api.vue

+5-4
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,12 @@ export default {
277277
});
278278
}
279279
break;
280+
} else if (!this.versions.includes(this.$route.query.v)) {
281+
this.$router.push({
282+
query: { v: this.versions[0] },
283+
hash: this.$route.hash
284+
});
280285
}
281-
this.$router.push({
282-
query: { v: this.versions[0] },
283-
hash: this.$route.hash
284-
});
285286
}
286287
}
287288

0 commit comments

Comments
 (0)