docs: add version dropdown

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
Bobby DeSimone 2019-10-01 15:05:23 -07:00
parent 1e4496c2b9
commit 7cef246d53
No known key found for this signature in database
GPG key ID: AEE4CF12FE86D07E
8 changed files with 173 additions and 165 deletions

View file

@ -5,12 +5,6 @@
<DropdownLink v-if="item.type === 'links'" :item="item" />
<NavLink v-else :item="item" />
</div>
<!-- repo link -->
<a v-if="repoLink" :href="repoLink" class="repo-link" target="_blank" rel="noopener noreferrer">
{{ repoLabel }}
<OutboundLink />
</a>
</nav>
</template>
@ -65,31 +59,6 @@ export default {
items: (link.items || []).map(resolveNavLinkItem)
});
});
},
repoLink() {
const { repo } = this.$site.themeConfig;
if (repo) {
return /^https?:/.test(repo) ? repo : `https://github.com/${repo}`;
}
},
repoLabel() {
if (!this.repoLink) return;
if (this.$site.themeConfig.repoLabel) {
return this.$site.themeConfig.repoLabel;
}
const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0];
const platforms = ["GitHub", "GitLab", "Bitbucket"];
for (let i = 0; i < platforms.length; i++) {
const platform = platforms[i];
if (new RegExp(platform, "i").test(repoHost)) {
return platform;
}
}
return "Source";
}
}
};