Skip to content

Commit 9921496

Browse files
committed
feat(nx-dev): update top-level navbar
1 parent 6904789 commit 9921496

File tree

22 files changed

+317
-398
lines changed

22 files changed

+317
-398
lines changed

docs/blog/2024-10-25-sports-retailer-success.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Improve your architecture and CI pipeline times with Nx projects
33
slug: improve-architecture-and-ci-times-with-projects
44
authors: [Philip Fulcher]
5-
tags: [nx, enterprise]
5+
tags: [nx, 'customer story']
66
cover_image: '/blog/images/2024-10-25/header.avif'
77
pinned: true
88
---

nx-dev/nx-dev/app/blog/[slug]/page.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Metadata, ResolvingMetadata } from 'next';
22
import { blogApi } from '../../../lib/blog.api';
33
import { BlogDetails } from '@nx/nx-dev/ui-blog';
44
import { DefaultLayout } from '@nx/nx-dev/ui-common';
5+
import { tryNxCloudForFree } from '../../../lib/components/headerCtaConfigs';
56

67
interface BlogPostDetailProps {
78
params: { slug: string };
@@ -44,12 +45,13 @@ export async function generateStaticParams() {
4445
export default async function BlogPostDetail({
4546
params: { slug },
4647
}: BlogPostDetailProps) {
48+
const ctaHeaderConfig = [tryNxCloudForFree];
4749
const blog = await blogApi.getBlogPostBySlug(slug);
4850
return blog ? (
4951
<>
5052
{/* This empty div is necessary as app router does not automatically scroll on route changes */}
5153
<div></div>
52-
<DefaultLayout>
54+
<DefaultLayout headerCTAConfig={ctaHeaderConfig}>
5355
<BlogDetails post={blog} />
5456
</DefaultLayout>
5557
</>

nx-dev/nx-dev/app/blog/page.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import { blogApi } from '../../lib/blog.api';
33
import { BlogContainer } from '@nx/nx-dev/ui-blog';
44
import { DefaultLayout } from '@nx/nx-dev/ui-common';
55
import { Suspense } from 'react';
6+
import {
7+
requestFreeTrial,
8+
tryNxCloudForFree,
9+
} from '../../lib/components/headerCtaConfigs';
610

711
export const metadata: Metadata = {
812
title: 'Nx Blog - Updates from the Nx & Nx Cloud team',
@@ -34,11 +38,13 @@ async function getBlogTags() {
3438
}
3539

3640
export default async function BlogIndex() {
41+
const ctaHeaderConfig = [tryNxCloudForFree];
42+
3743
const blogs = await getBlogs();
3844
const tags = await getBlogTags();
3945
return (
4046
<Suspense>
41-
<DefaultLayout>
47+
<DefaultLayout headerCTAConfig={ctaHeaderConfig}>
4248
<BlogContainer blogPosts={blogs} tags={tags} />
4349
</DefaultLayout>
4450
</Suspense>

nx-dev/nx-dev/app/nx-cloud/page.tsx

+16-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import {
99
Statistics,
1010
} from '@nx/nx-dev/ui-cloud';
1111

12-
import { CallToAction, DefaultLayout } from '@nx/nx-dev/ui-common';
12+
import {
13+
ButtonLinkProps,
14+
CallToAction,
15+
DefaultLayout,
16+
} from '@nx/nx-dev/ui-common';
1317

1418
import type { Metadata } from 'next';
1519

@@ -37,8 +41,18 @@ export const metadata: Metadata = {
3741
};
3842

3943
export default function NxCloudPage(): JSX.Element {
44+
const headerCTAConfig: ButtonLinkProps[] = [
45+
{
46+
href: '/pricing',
47+
variant: 'primary',
48+
size: 'small',
49+
title: 'Get started for free',
50+
children: 'Get started for free',
51+
},
52+
];
53+
4054
return (
41-
<DefaultLayout>
55+
<DefaultLayout headerCTAConfig={headerCTAConfig}>
4256
<Hero />
4357
<TrustedBy />
4458

nx-dev/nx-dev/app/powerpack/page.tsx

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { DefaultLayout } from '@nx/nx-dev/ui-common';
1+
import { ButtonLinkProps, DefaultLayout } from '@nx/nx-dev/ui-common';
22
import {
33
CallToAction,
44
GetStarted,
55
Hero,
66
PowerpackFeatures,
77
} from '@nx/nx-dev/ui-powerpack';
8+
import { contactButton } from '../../lib/components/headerCtaConfigs';
89

910
import type { Metadata } from 'next';
1011

@@ -32,8 +33,18 @@ export const metadata: Metadata = {
3233
};
3334

3435
export default function NxPowerPackPage(): JSX.Element {
36+
const headerCTAConfig: ButtonLinkProps[] = [
37+
{
38+
href: 'https://cloud.nx.app/powerpack/purchase?licenseBusinessType=small&utm_source=nx.dev&utm_medium=referral&utm_campaign=nx-powerpackurl',
39+
variant: 'primary',
40+
size: 'small',
41+
title: 'Request a free trial',
42+
children: 'Request a free trial',
43+
},
44+
];
45+
3546
return (
36-
<DefaultLayout>
47+
<DefaultLayout headerCTAConfig={headerCTAConfig}>
3748
<Hero />
3849

3950
<div className="mt-32 scroll-mt-32 lg:mt-56" id="features">

nx-dev/nx-dev/app/pricing/page.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Testimonials,
1313
TrustedBy,
1414
} from '@nx/nx-dev/ui-common';
15+
import { gotoAppButton } from '../../lib/components/headerCtaConfigs';
1516

1617
export const metadata: Metadata = {
1718
title: 'Nx Cloud - Available Plans',
@@ -38,7 +39,7 @@ export const metadata: Metadata = {
3839

3940
export default function PricingPage() {
4041
return (
41-
<DefaultLayout>
42+
<DefaultLayout headerCTAConfig={[gotoAppButton]}>
4243
<PlansDisplay />
4344
<div className="mt-18 lg:mt-32">
4445
<TrustedBy utmSource="pricingpage" utmCampaign="pricing" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { ButtonLinkProps } from '@nx/nx-dev/ui-common';
2+
import { NxCloudAnimatedIcon } from '@nx/nx-dev/ui-icons';
3+
4+
export const requestFreeTrial: ButtonLinkProps = {
5+
href: '/contact/sales',
6+
variant: 'primary',
7+
size: 'small',
8+
title: 'Request a free trial',
9+
children: 'Request a free trial',
10+
};
11+
12+
export const tryNxCloudForFree: ButtonLinkProps = {
13+
href: '/pricing',
14+
variant: 'primary',
15+
size: 'small',
16+
title: 'Try Nx Cloud for free',
17+
children: 'Try Nx Cloud for free',
18+
};
19+
20+
export const gotoAppButton: ButtonLinkProps = {
21+
href: 'https://nx.app/?utm_source=nx.dev&utm_medium=header-menu',
22+
variant: 'secondary',
23+
size: 'small',
24+
target: '_blank',
25+
title: 'Log in to your Nx Cloud Account',
26+
children: (
27+
<>
28+
<NxCloudAnimatedIcon className="h-4 w-4" aria-hidden="true" />
29+
<span>Go to app</span>
30+
</>
31+
),
32+
};
33+
34+
export const contactButton: ButtonLinkProps = {
35+
href: '/contact',
36+
variant: 'secondary',
37+
size: 'small',
38+
target: '_blank',
39+
title: 'Contact Us',
40+
children: <span>Contact</span>,
41+
};

nx-dev/nx-dev/pages/customers.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Hero,
77
OssProjects,
88
} from '@nx/nx-dev/ui-customers';
9+
import { tryNxCloudForFree } from '../lib/components/headerCtaConfigs';
910

1011
export function Customers(): JSX.Element {
1112
const router = useRouter();
@@ -33,7 +34,7 @@ export function Customers(): JSX.Element {
3334
type: 'website',
3435
}}
3536
/>
36-
<DefaultLayout>
37+
<DefaultLayout headerCTAConfig={[tryNxCloudForFree]}>
3738
<div>
3839
<Hero />
3940
</div>

nx-dev/nx-dev/pages/enterprise.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
SolveYourCi,
1414
} from '@nx/nx-dev/ui-enterprise';
1515
import { TrialCallout } from '@nx/nx-dev/ui-pricing';
16+
import { requestFreeTrial } from '../lib/components/headerCtaConfigs';
1617

1718
export function Enterprise(): JSX.Element {
1819
const router = useRouter();
@@ -40,7 +41,7 @@ export function Enterprise(): JSX.Element {
4041
type: 'website',
4142
}}
4243
/>
43-
<DefaultLayout>
44+
<DefaultLayout headerCTAConfig={[requestFreeTrial]}>
4445
<div>
4546
<Hero />
4647
</div>

nx-dev/nx-dev/pages/index.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ import {
88
TeamAndCommunity,
99
WorkBetterAchieveMoreShipQuicker,
1010
} from '@nx/nx-dev/ui-home';
11+
import {
12+
requestFreeTrial,
13+
gotoAppButton,
14+
contactButton,
15+
} from '../lib/components/headerCtaConfigs';
1116

1217
export default function Index(): JSX.Element {
18+
const headerCTAConfig = [contactButton];
19+
1320
return (
1421
<>
1522
<NextSeo
@@ -34,7 +41,7 @@ export default function Index(): JSX.Element {
3441
}}
3542
/>
3643
<h1 className="sr-only">Build system with advanced CI capabilities.</h1>
37-
<DefaultLayout isHome>
44+
<DefaultLayout isHome headerCTAConfig={headerCTAConfig}>
3845
<Hero />
3946
<div className="mt-16 lg:-mt-32">
4047
<Statistics />

nx-dev/ui-cloud/src/lib/hero.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ComponentProps, Fragment, useState } from 'react';
77
import { ButtonLink, SectionHeading } from '@nx/nx-dev/ui-common';
88
import { MovingBorder } from '@nx/nx-dev/ui-animations';
99
import Image from 'next/image';
10+
import { NxCloudAnimatedIcon } from '@nx/nx-dev/ui-icons';
1011

1112
export function Hero(): JSX.Element {
1213
const [isOpen, setIsOpen] = useState(false);
@@ -31,7 +32,8 @@ export function Hero(): JSX.Element {
3132
variant="primary"
3233
size="default"
3334
>
34-
Get started
35+
<NxCloudAnimatedIcon className="h-4 w-4" aria-hidden="true" />
36+
<span>Go to app</span>
3537
</ButtonLink>
3638
<ButtonLink
3739
href="/ci/intro/ci-with-nx"

nx-dev/ui-common/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export * from './lib/square-dotted-pattern';
2525
export * from './lib/live-stream-notifier';
2626

2727
export { resourceMenuItems } from './lib/headers/menu-items';
28-
export { solutionsMenuItems } from './lib/headers/menu-items';
28+
export { productsMenuItems as solutionsMenuItems } from './lib/headers/menu-items';
2929
export { eventItems } from './lib/headers/menu-items';
3030
export { learnItems } from './lib/headers/menu-items';
3131
export { companyItems } from './lib/headers/menu-items';
3232
export type { MenuItem } from './lib/headers/menu-items';
33-
export { solutions as plans } from './lib/headers/menu-items';
33+
export { ossProducts as plans } from './lib/headers/menu-items';
3434
export { featuresItems } from './lib/headers/menu-items';
3535
export { DefaultMenuItem } from './lib/headers/default-menu-item';
3636
export { MobileMenuItem } from './lib/headers/mobile-menu-item';

nx-dev/ui-common/src/lib/button.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ interface ButtonProps {
1717
children: ReactNode | ReactNode[];
1818
}
1919

20+
export type ButtonLinkProps = ButtonProps & {
21+
className?: string;
22+
href: string;
23+
title: string;
24+
} & AnchorHTMLAttributes<HTMLAnchorElement>;
25+
2026
const variantStyles: Record<AllowedVariants, string> = {
2127
primary:
2228
'bg-blue-500 dark:bg-sky-500 text-white group-hover:bg-blue-600 dark:group-hover:bg-sky-600 group-focus:ring-2 group-focus:ring-blue-500 dark:group-focus:ring-sky-500 focus:group-ring-offset-2',
@@ -99,11 +105,7 @@ export const ButtonLink = forwardRef(function (
99105
variant = 'primary',
100106
title = '',
101107
...props
102-
}: ButtonProps & {
103-
className?: string;
104-
href: string;
105-
title: string;
106-
} & AnchorHTMLAttributes<HTMLAnchorElement>,
108+
}: ButtonLinkProps,
107109
ref: ForwardedRef<HTMLAnchorElement>
108110
): JSX.Element {
109111
return (

nx-dev/ui-common/src/lib/default-layout.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import { Footer } from './footer';
22
import { Header } from './headers/header';
33
import { PropsWithChildren } from 'react';
4-
import cx from 'classnames';
4+
import { ButtonLinkProps } from './button';
55

66
export function DefaultLayout({
77
isHome = false,
88
children,
99
hideHeader = false,
1010
hideFooter = false,
11+
headerCTAConfig,
1112
}: {
1213
isHome?: boolean;
1314
hideHeader?: boolean;
1415
hideFooter?: boolean;
16+
headerCTAConfig?: ButtonLinkProps[];
1517
} & PropsWithChildren): JSX.Element {
1618
return (
1719
<div className="w-full overflow-hidden dark:bg-slate-950">
18-
{!hideHeader && <Header />}
20+
{!hideHeader && <Header ctaButtons={headerCTAConfig} />}
1921
<div className="relative isolate">
2022
<div
2123
className="absolute inset-x-0 -top-40 -z-10 h-full transform-gpu overflow-hidden blur-3xl sm:-top-80"

0 commit comments

Comments
 (0)