Skip to content

Commit 9da9b4a

Browse files
juristrjaysoo
authored andcommitted
feat(nx-dev): linkable resources page
1 parent 5049e27 commit 9da9b4a

File tree

2 files changed

+133
-0
lines changed

2 files changed

+133
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
import React from 'react';
2+
import { DefaultLayout, SectionHeading } from '@nx/nx-dev/ui-common';
3+
import {
4+
learnItems,
5+
eventItems,
6+
companyItems,
7+
MenuItem,
8+
} from '@nx/nx-dev/ui-common';
9+
import { cx } from '@nx/nx-dev/ui-primitives';
10+
import { Metadata } from 'next';
11+
12+
interface ResourceCardProps {
13+
item: MenuItem;
14+
}
15+
16+
function Hero(): JSX.Element {
17+
return (
18+
<section className="relative overflow-hidden py-16 dark:from-slate-900 dark:to-slate-950">
19+
<div className="mx-auto max-w-3xl text-center">
20+
<SectionHeading
21+
as="h1"
22+
variant="display"
23+
className="text-6xl font-extrabold tracking-tight"
24+
>
25+
Nx Resources
26+
</SectionHeading>
27+
<SectionHeading
28+
as="p"
29+
variant="subtitle"
30+
className="mx-auto mt-6 max-w-3xl text-xl text-slate-600 dark:text-slate-400"
31+
>
32+
Learning ⋅ Events ⋅ Company
33+
</SectionHeading>
34+
</div>
35+
</section>
36+
);
37+
}
38+
39+
function ResourceCard({ item }: ResourceCardProps) {
40+
return (
41+
<a href={item.href} className="block h-full transform-gpu">
42+
<div
43+
className={cx(
44+
'group relative h-full w-full overflow-hidden rounded-2xl border border-slate-200 bg-white p-8',
45+
'dark:border-slate-800 dark:bg-slate-900 dark:hover:border-blue-900 dark:hover:shadow-blue-900/20',
46+
'before:absolute before:inset-0 before:z-0 before:bg-gradient-to-br before:from-blue-50 before:to-transparent before:opacity-0 before:transition-opacity',
47+
'transition-all duration-300 ease-out',
48+
'hover:-translate-y-2 hover:border-blue-200 hover:shadow-xl hover:shadow-blue-100/50',
49+
'hover:before:opacity-100 dark:before:from-blue-950'
50+
)}
51+
>
52+
<div className="relative z-10">
53+
{item.icon && (
54+
<div className="mb-6 flex h-14 w-14 items-center justify-center rounded-xl bg-blue-50 group-hover:bg-blue-100 dark:bg-slate-800 dark:group-hover:bg-blue-900">
55+
<item.icon className="h-8 w-8 text-blue-600 transition-transform duration-300 group-hover:scale-110 dark:text-blue-400" />
56+
</div>
57+
)}
58+
<p className="text-xl font-medium text-slate-900 transition-colors duration-200 dark:text-slate-100">
59+
{item.name}
60+
</p>
61+
{item.description && (
62+
<p className="mt-3 text-slate-600 transition-colors duration-200 dark:text-slate-400">
63+
{item.description}
64+
</p>
65+
)}
66+
</div>
67+
</div>
68+
</a>
69+
);
70+
}
71+
72+
function ResourceSection({
73+
title,
74+
items,
75+
}: {
76+
title: string;
77+
items: MenuItem[];
78+
}) {
79+
return (
80+
<div className="mt-20">
81+
<SectionHeading
82+
as="h2"
83+
variant="title"
84+
className="pb-12 text-4xl font-bold tracking-tight"
85+
>
86+
{title}
87+
</SectionHeading>
88+
<div className="grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4">
89+
{items.map((item) => (
90+
<ResourceCard key={item.name} item={item} />
91+
))}
92+
</div>
93+
</div>
94+
);
95+
}
96+
97+
export const metadata: Metadata = {
98+
title: 'Resources',
99+
description:
100+
'Explore Nx resources including tutorials, code examples, podcasts, and more.',
101+
openGraph: {
102+
url: 'https://nx.dev/resources',
103+
title: 'Nx Resources',
104+
description:
105+
'Explore Nx resources including tutorials, code examples, podcasts, and more.',
106+
images: [
107+
{
108+
url: 'https://nx.dev/socials/nx-media.png',
109+
width: 800,
110+
height: 421,
111+
alt: 'Nx: Smart Monorepos · Fast CI',
112+
type: 'image/jpeg',
113+
},
114+
],
115+
siteName: 'NxDev',
116+
type: 'website',
117+
},
118+
};
119+
120+
export default function Resources() {
121+
return (
122+
<DefaultLayout>
123+
<Hero />
124+
<div className="mx-auto max-w-7xl px-6 py-16 sm:px-8 lg:px-12">
125+
<ResourceSection title="Learn" items={learnItems} />
126+
<ResourceSection title="Events" items={eventItems} />
127+
<ResourceSection title="Company" items={companyItems} />
128+
</div>
129+
</DefaultLayout>
130+
);
131+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export { resourceMenuItems } from './lib/headers/menu-items';
2828
export { solutionsMenuItems } from './lib/headers/menu-items';
2929
export { eventItems } from './lib/headers/menu-items';
3030
export { learnItems } from './lib/headers/menu-items';
31+
export { companyItems } from './lib/headers/menu-items';
32+
export type { MenuItem } from './lib/headers/menu-items';
3133
export { solutions as plans } from './lib/headers/menu-items';
3234
export { featuresItems } from './lib/headers/menu-items';
3335
export { DefaultMenuItem } from './lib/headers/default-menu-item';

0 commit comments

Comments
 (0)