Skip to content

Commit 5fec526

Browse files
authored
feat(docs): add Talk to Our Engineers button to navbar (CopilotKit#4590)
## Summary - Adds a **Talk to Our Engineers** CTA button to the right side of the docs navbar, mirroring the new website's nav button. - Wires the same PostHog `talk_to_us_clicked` event the website fires, with `{ location: "docs_nav" }` so docs-originated clicks can be segmented from website clicks (`"nav"`) in PostHog. - Fixes a pre-existing layout bug where the navbar's slanted SVG borders were sized in fixed pixels (`w-[24px] h-[60px]` / `xl:w-[29px] xl:h-[72px]`) and didn't follow the nav's actual height once Chrome's default font size was scaled above 16px — the wedge of page background that leaked through the join is now sealed. ## Behavior | Viewport | Button | |---|---| | `>= 1400px` | Visible | | `1024–1399px` | Hidden (button text would otherwise force the left links to wrap) | | `< 1024px` | Hidden — mobile burger menu surfaces the link | The button uses `text-muted-foreground` for the resting state to match the existing nav links and an indigo `#7076D5` hover accent that matches the active-link underline color. Target is `https://copilotkit.ai/contact-us` (absolute since docs runs on the `docs.` subdomain). ## Test plan - [ ] Click the button on a wide viewport — navigates to `https://copilotkit.ai/contact-us` and fires `talk_to_us_clicked` with `{ location: "docs_nav" }` in PostHog. - [ ] Resize from > 1400px down through 1024px and below — button shows / hides at the right thresholds with no left-link wrapping. - [ ] Toggle dark mode — button border and text stay legible, hover accent still indigo. - [ ] Set Chrome's default font size to 20px and reload — no wedge gap at the slanted-border join between the left and right pill containers.
2 parents c7aae15 + 1f9e668 commit 5fec526

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

docs/components/layout/navbar.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useState, useEffect } from "react";
44
import Image from "next/image";
55
import Link from "fumadocs-core/link";
66
import { usePathname } from "next/navigation";
7+
import { usePostHog } from "posthog-js/react";
78
import { DocsLayoutProps } from "fumadocs-ui/layouts/docs";
89
// Components
910
import { Logo } from "@/app/logo";
@@ -79,6 +80,12 @@ const Navbar = ({ pageTree }: NavbarProps) => {
7980
const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useState(false);
8081
const [lastDocsPath, setLastDocsPath] = useState<string | null>(null);
8182
const pathname = usePathname();
83+
const posthog = usePostHog();
84+
85+
const handleTalkToEngineersClick = () => {
86+
posthog?.capture("talk_to_us_clicked", { location: "docs_nav" });
87+
window.location.href = "https://copilotkit.ai/contact-us";
88+
};
8289

8390
// Read sessionStorage on client only to avoid hydration mismatch (tab-specific)
8491
useEffect(() => {
@@ -208,14 +215,14 @@ const Navbar = ({ pageTree }: NavbarProps) => {
208215
alt="Slanted end border"
209216
width={29}
210217
height={72}
211-
className="hidden -ml-px dark:inline-block shrink-0 w-[24px] h-[60px] xl:w-[29px] xl:h-[72px] object-cover"
218+
className="hidden -ml-px dark:inline-block shrink-0 h-full w-auto object-cover"
212219
/>
213220
<Image
214221
src="/images/navbar/slanted-end-border-light.svg"
215222
alt="Slanted end border"
216223
width={29}
217224
height={72}
218-
className="-ml-px dark:hidden shrink-0 w-[24px] h-[60px] xl:w-[29px] xl:h-[72px] object-cover"
225+
className="-ml-px dark:hidden shrink-0 h-full w-auto object-cover"
219226
/>
220227
</div>
221228

@@ -225,20 +232,29 @@ const Navbar = ({ pageTree }: NavbarProps) => {
225232
alt="Slanted start border"
226233
width={29}
227234
height={72}
228-
className="hidden -mr-px dark:inline-block shrink-0 w-[24px] h-[60px] xl:w-[29px] xl:h-[72px] object-cover"
235+
className="hidden -mr-px dark:inline-block shrink-0 h-full w-auto object-cover"
229236
/>
230237
<Image
231238
src="/images/navbar/slanted-start-border-light.svg"
232239
alt="Slanted start border"
233240
width={29}
234241
height={72}
235-
className="-mr-px dark:hidden shrink-0 w-[24px] h-[60px] xl:w-[29px] xl:h-[72px] object-cover"
242+
className="-mr-px dark:hidden shrink-0 h-full w-auto object-cover"
236243
/>
237244

238245
<div
239246
className="flex gap-1 items-center pr-2 w-max h-full rounded-r-2xl border border-l-0 backdrop-blur-lg md:pr-4 shrink-0 border-border"
240247
style={{ backgroundColor: "var(--sidebar)" }}
241248
>
249+
<button
250+
type="button"
251+
onClick={handleTalkToEngineersClick}
252+
className="hidden [@media(width>=1400px)]:flex items-center h-9 px-4 mr-2 text-sm font-medium rounded-full border border-border bg-transparent text-muted-foreground hover:text-[#7076D5] hover:border-[#7076D5] hover:bg-[#7076D5]/10 transition-colors duration-200 cursor-pointer whitespace-nowrap"
253+
aria-label="Talk to our engineers"
254+
>
255+
Talk to Our Engineers
256+
</button>
257+
242258
{RIGHT_LINKS.map((link) => {
243259
// Only show Free Developer Access at narrow widths (between 768px and 1028px)
244260
const isIconOnlyLink = link.label === "Free Developer Access";

0 commit comments

Comments
 (0)