Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Back buttons

Tim Wilsond9449a866b57
diff --git a/apps/web/ui/layout/sidebar/sidebar-nav.tsx b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
index 7fc4cd3e43..f15bebffce 100644
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@ -1,5 +1,6 @@
import {
AnimatedSizeContainer,
+ ChevronLeft,
ClientOnly,
Icon,
NavWordmark,
@@ -116,8 +117,11 @@ export function SidebarNav<T extends Record<any, any>>({
<div className="relative flex grow flex-col p-3 text-neutral-500">
<div className="relative w-full grow">
{Object.entries(areas).map(([area, areaConfig]) => {
- const { title, content, showNews, direction } =
+ const { title, backHref, content, showNews, direction } =
areaConfig(data);
+
+ const TitleContainer = backHref ? Link : "div";
+
return (
<Area
key={area}
@@ -125,9 +129,25 @@ export function SidebarNav<T extends Record<any, any>>({
direction={direction ?? "right"}
>
{title && (
- <span className="text-content-emphasis mb-3 block px-3 py-1 text-lg font-semibold">
- {title}
- </span>
+ // @ts-ignore - TS can't handle the conditional Link+href
+ <TitleContainer
+ {...(backHref ? { href: backHref } : {})}
+ className="group mb-3 flex items-center gap-3 px-3 py-1"
+ >
+ {backHref && (
+ <div
+ className={cn(
+ "text-content-muted bg-bg-emphasis flex size-6 items-center justify-center rounded-lg",
+ "group-hover:bg-bg-inverted/10 group-hover:text-content-subtle transition-[transform,background-color,color] duration-150 group-hover:-translate-x-0.5",
+ )}
+ >
+ <ChevronLeft className="size-3 [&_*]:stroke-2" />
+ </div>
+ )}
+ <span className="text-content-emphasis text-lg font-semibold">
+ {title}
+ </span>
+ </TitleContainer>
)}
<div className="flex flex-col gap-8">
{content.map(({ name, items }, idx) => (
diff --git a/packages/ui/src/icons/nucleo/chevron-left.tsx b/packages/ui/src/icons/nucleo/chevron-left.tsx
new file mode 100644
index 0000000000..99057c9759
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/chevron-left.tsx
@@ -0,0 +1,24 @@
+import { SVGProps } from "react";
+
+export function ChevronLeft(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <polyline
+ fill="none"
+ points="11.5 15.25 5.25 9 11.5 2.75"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index fd197fdc4c..f3cedfa6b6 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -38,6 +38,7 @@ export * from "./check";
export * from "./check2";
export * from "./checkbox-checked-fill";
export * from "./checkbox-unchecked";
+export * from "./chevron-left";
export * from "./circle-check";
export * from "./circle-check-fill";
export * from "./circle-dollar";