From 5220badc23ecdea91fd6e4f1b57009fac6e7cc31 Mon Sep 17 00:00:00 2001 From: james-a-morris Date: Tue, 17 Sep 2024 15:17:43 -0400 Subject: [PATCH] improve: add blog links to mobile footer/header nav Signed-off-by: james-a-morris --- src/app/_components/footer.tsx | 9 +++++- src/app/_components/header-nav/index.tsx | 11 ++++++- src/app/_components/icons/index.tsx | 1 + src/app/_components/icons/newspaper.tsx | 38 ++++++++++++++++++++++++ src/app/_components/link.tsx | 2 +- src/app/_constants/links.ts | 4 +++ 6 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 src/app/_components/icons/newspaper.tsx diff --git a/src/app/_components/footer.tsx b/src/app/_components/footer.tsx index be38ede..020b413 100644 --- a/src/app/_components/footer.tsx +++ b/src/app/_components/footer.tsx @@ -12,6 +12,7 @@ import { DocumentIcon, DiscourseIcon, GitHubIcon, + NewspaperIcon, } from "./icons"; import { IconBox } from "./icon-box"; import { PRODUCT_LINKS, SOCIAL_LINKS, INFORMATION_LINKS } from "@/app/_constants"; @@ -67,6 +68,12 @@ const socials = [ ]; const information = [ + { + ...INFORMATION_LINKS.blog, + Icon: NewspaperIcon, + iconClassName: "h-5 w-5", + iconContainerClassName: "bg-light-100/[.05]", + }, { ...INFORMATION_LINKS.docs, Icon: DocumentIcon, @@ -115,7 +122,7 @@ function FooterBox(props: {
{props.items.map((item) => (
- {props.useExternalLinks ? ( + {props.useExternalLinks && !item.href.startsWith("/") ? ( diff --git a/src/app/_components/header-nav/index.tsx b/src/app/_components/header-nav/index.tsx index 1767aa4..44b387d 100644 --- a/src/app/_components/header-nav/index.tsx +++ b/src/app/_components/header-nav/index.tsx @@ -5,7 +5,7 @@ import { usePathname } from "next/navigation"; import { useState } from "react"; import { twMerge } from "@/app/_lib/tw-merge"; -import { PRODUCT_LINKS, SOCIAL_LINKS } from "@/app/_constants"; +import { INFORMATION_LINKS, PRODUCT_LINKS, SOCIAL_LINKS } from "@/app/_constants"; import { AcrossIcon, @@ -18,6 +18,7 @@ import { TwitterIcon, MediumIcon, DiscourseIcon, + NewspaperIcon, } from "../icons"; import { Button } from "../button"; import { Text } from "../text"; @@ -80,6 +81,14 @@ const communityNavigationItems = [ iconContainerClassName: "bg-light-100/[.05]", containerClassName: "group-hover:bg-light-100/[.05]", }, + { + ...INFORMATION_LINKS.blog, + description: "Across Blog", + Icon: NewspaperIcon, + iconClassName: "h-4 w-4", + iconContainerClassName: "bg-light-100/[.05]", + containerClassName: "group-hover:bg-light-100/[.05]", + }, ]; export function HeaderNav() { diff --git a/src/app/_components/icons/index.tsx b/src/app/_components/icons/index.tsx index 25e4b21..2c524a5 100644 --- a/src/app/_components/icons/index.tsx +++ b/src/app/_components/icons/index.tsx @@ -18,6 +18,7 @@ export { DiscourseIcon } from "./discourse"; export { GitHubIcon } from "./github"; export { LinkIcon } from "./link"; export { SearchIcon } from "./search"; +export { NewspaperIcon } from "./newspaper"; // Gradient icons export { ArrowUpIcon } from "./gradient/arrow-up"; diff --git a/src/app/_components/icons/newspaper.tsx b/src/app/_components/icons/newspaper.tsx new file mode 100644 index 0000000..17722a3 --- /dev/null +++ b/src/app/_components/icons/newspaper.tsx @@ -0,0 +1,38 @@ +import { SVGProps } from "react"; + +export function NewspaperIcon(props: SVGProps) { + return ( + + + + + + + ); +} diff --git a/src/app/_components/link.tsx b/src/app/_components/link.tsx index be3d43a..2c44251 100644 --- a/src/app/_components/link.tsx +++ b/src/app/_components/link.tsx @@ -17,7 +17,7 @@ type CustomLinkProps = LinkProps & { */ function CustomLink({ href, preserveQueryParams, ...props }: CustomLinkProps) { const params = useSearchParams(); - if (preserveQueryParams && !href.toString().includes("?")) { + if (preserveQueryParams && params.size > 0 && !href.toString().includes("?")) { href = `${href.toString()}?${params.toString()}`; } return ; diff --git a/src/app/_constants/links.ts b/src/app/_constants/links.ts index de69815..8143ffd 100644 --- a/src/app/_constants/links.ts +++ b/src/app/_constants/links.ts @@ -48,6 +48,10 @@ export const INFORMATION_LINKS = { label: "Docs", href: "https://docs.across.to/v/v3-developer-docs/introduction/what-is-across", }, + blog: { + label: "Blog", + href: "/blog", + }, }; export const INTEGRATION_LINKS = {