feat: Show icon on external links (#3100)

* feat: External links get treatment

* cache decorations
This commit is contained in:
Tom Moor
2022-02-16 18:05:02 -08:00
committed by GitHub
parent 3760a03c44
commit d7ee801fe4
11 changed files with 162 additions and 73 deletions

View File

@@ -1,25 +1,3 @@
import { parseDomain } from "@shared/utils/domains";
export function isInternalUrl(href: string) {
if (href[0] === "/") {
return true;
}
const outline = parseDomain(window.location.href);
const parsed = parseDomain(href);
if (
parsed &&
outline &&
parsed.subdomain === outline.subdomain &&
parsed.domain === outline.domain &&
parsed.tld === outline.tld
) {
return true;
}
return false;
}
export function isHash(href: string) {
if (href[0] === "#") {
return true;