-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Changing repo label depending on the host #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
34ccc58
bb33ae3
a72e8a4
0e18730
1a103a4
7fac79e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
.temp | ||
vuepress | ||
TODOs.md | ||
*.sw* | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<template> | ||
<nav class="nav-links" v-if="userLinks.length || githubLink"> | ||
<nav class="nav-links" v-if="userLinks.length || repoLink"> | ||
<!-- user links --> | ||
<div | ||
class="nav-item" | ||
|
@@ -8,13 +8,13 @@ | |
<DropdownLink v-if="item.type === 'links'" :item="item"/> | ||
<NavLink v-else :item="item"/> | ||
</div> | ||
<!-- github link --> | ||
<a v-if="githubLink" | ||
:href="githubLink" | ||
class="github-link" | ||
<!-- repo link --> | ||
<a v-if="repoLink" | ||
:href="repoLink" | ||
class="repo-link" | ||
target="_blank" | ||
rel="noopener noreferrer"> | ||
GitHub | ||
{{ repoLabel }} | ||
<OutboundLink/> | ||
</a> | ||
</nav> | ||
|
@@ -69,14 +69,22 @@ export default { | |
}) | ||
})) | ||
}, | ||
githubLink () { | ||
repoLink () { | ||
const { repo } = this.$site.themeConfig | ||
if (repo) { | ||
return /^https?:/.test(repo) | ||
? repo | ||
: `https://github.com/${repo}` | ||
} | ||
} | ||
}, | ||
repoLabel () { | ||
if (this.$site.themeConfig.repoLabel) return this.$site.themeConfig.repoLabel | ||
|
||
const repoHost = this.repoLink.match(/^https?:\/\/[^/]+/)[0] || 'github' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since repo link start with in other words, the statements There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is true. Will fix this later. |
||
return ['GitHub', 'GitLab', 'Bitbucket'].find(platform => { | ||
return repoHost.toLowerCase().includes(platform.toLowerCase()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In client side you shouldn't use BTW, why define a Uppercase constant and then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh okay, I would change this to Defining uppercase constants since they are what we want to show on the header, lowercase since we want to compare. But actually using regex with case insensitive flag and match would be nicer. |
||
}); | ||
}, | ||
}, | ||
methods: { | ||
isActive | ||
|
@@ -100,12 +108,12 @@ export default { | |
display inline-block | ||
margin-left 1.5rem | ||
line-height 2rem | ||
.github-link | ||
.repo-link | ||
margin-left 1.5rem | ||
|
||
@media (max-width: $MQMobile) | ||
.nav-links | ||
.nav-item, .github-link | ||
.nav-item, .repo-link | ||
margin-left 0 | ||
|
||
@media (min-width: $MQMobile) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why adding this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For vim swap files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add it at your project instead of here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thought it would be great since there might be other contributors who use vim.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, so should I put all the different needs here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's up to you guys. I could remove it if you don't like it.
I just feel that it's not something that will hurt to add and might make other vim contributors lives easier. If there are other contributors who uses other editors which has some other ignore files, I couldn't see why we shouldn't facilitate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't depend on me. please do not kidnap thinking.
What I want to say it that you can set this to a global git configuration instead of duplicating it everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is certainly not true for me. I am happy to remove that if this is not wanted.