Skip to content

Commit

Permalink
Merge pull request #17 from kjloveless/updates
Browse files Browse the repository at this point in the history
remove unneeded function call and check if running on localhost
  • Loading branch information
kjloveless authored Oct 11, 2024
2 parents 9d527b3 + 588b810 commit 794af40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
19 changes: 10 additions & 9 deletions islands/link.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { JSX } from "preact";
import { IS_BROWSER } from "$fresh/runtime.ts";

// import { getDomain } from "../util/mod.ts"; fix this shit breaking the nacbar when it fails
import { getDomain } from "../util/mod.ts";

export function Link(
{ href, ...props }: JSX.HTMLAttributes<HTMLAnchorElement>,
) {
if (
IS_BROWSER && typeof href === "string" && typeof window !== "undefined"
IS_BROWSER && typeof href === "string" && typeof window !== "undefined" &&
window.location.hostname !== "localhost"
) {
// const { subdomain, domain } = getDomain(window.location.hostname);
// console.log(subdomain, domain);
// if (subdomain) {
// return <a href={`https://${domain}${href}`} {...props} />;
// } else {
return <a href={href} {...props} />;
// }
const { subdomain, domain } = getDomain(window.location.hostname);
console.log(subdomain, domain);
if (subdomain) {
return <a href={`https://${domain}${href}`} {...props} />;
} else {
return <a href={href} {...props} />;
}
} else {
return <a href={href} {...props} />;
}
Expand Down
5 changes: 1 addition & 4 deletions islands/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ export default function SiteHeader({ children }: Props) {
</header>
{showMenu && (
<div
className={cn(
"fixed top-16 z-30 w-full overflow-hidden border-b bg-background/80 transition-transform duration-500 md:hidden",
// showMenu ? "translate-y-1px" : "-translate-y-full",
)}
className="fixed top-16 z-30 w-full overflow-hidden border-b bg-background/80 transition-transform duration-500 md:hidden"
aria-hidden={!showMenu}
>
<div className="container flex h-full flex-col items-center justify-stretch px-4 pb-2">
Expand Down

0 comments on commit 794af40

Please sign in to comment.