Skip to content

Commit

Permalink
only use the github icon for github urls
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonstyle committed Jul 13, 2023
1 parent cf254a8 commit 94448af
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/project/types/website/website-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,22 +725,25 @@ function repoActionLinks(
language: FormatLanguage,
issueUrl?: string,
): Array<{ text: string; url: string; icon?: string }> {
const firstIcon = repoInfo.baseUrl.indexOf("github.com") !== -1
? "github"
: "git";
return actions.map((action, i) => {
switch (action) {
case "edit":
if (!isJupyterNotebook(source)) {
return {
text: language[kRepoActionLinksEdit],
url: `${repoInfo.baseUrl}edit/${branch}/${repoInfo.path}${source}`,
icon: i === 0 ? "github" : undefined,
icon: i === 0 ? firstIcon : undefined,
};
} else if (repoInfo.baseUrl.indexOf("github.com") !== -1) {
return {
text: language[kRepoActionLinksEdit],
url: `${
repoInfo.baseUrl.replace("github.com", "github.dev")
}blob/${branch}/${repoInfo.path}${source}`,
icon: i === 0 ? "github" : undefined,
icon: i === 0 ? firstIcon : undefined,
};
} else {
return null;
Expand All @@ -749,13 +752,13 @@ function repoActionLinks(
return {
text: language[kRepoActionLinksSource],
url: `${repoInfo.baseUrl}blob/${branch}/${repoInfo.path}${source}`,
icon: i === 0 ? "github" : undefined,
icon: i === 0 ? firstIcon : undefined,
};
case "issue":
return {
text: language[kRepoActionLinksIssue],
url: issueUrl || `${repoInfo.baseUrl}issues/new`,
icon: i === 0 ? "github" : undefined,
icon: i === 0 ? firstIcon : undefined,
};

default: {
Expand Down

0 comments on commit 94448af

Please sign in to comment.