Skip to content

Commit 70494ae

Browse files
hasparusardatan
andauthored
add Playwright to the website and unify styles (#4222)
* Downgrade Tailwind to 3.4.17 to fix the website * Add Playwright config * Move metadata to another file because Next loads layout modules out of order now * Add Hive fonts * Use HiveLayout * Assert website renders * Make the logo match designs * Bump Tailwind again * Prevent dedupe * Fix lint errors --------- Co-authored-by: Arda TANRIKULU <[email protected]>
1 parent 26a7a08 commit 70494ae

File tree

14 files changed

+198
-81
lines changed

14 files changed

+198
-81
lines changed

pnpm-lock.yaml

Lines changed: 48 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

website/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.next/
22
public/sitemap*.xml
33
public/_redirects
4+
.playwright-artifacts/
5+
playwright-report/

website/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"dev": "next --turbopack",
1111
"pagefind": "pagefind --site .next/server/app --output-path out/_pagefind",
1212
"postbuild": "next-sitemap && tsx scripts/sitemap-ci && pnpm pagefind",
13-
"start": "next start"
13+
"start": "next start",
14+
"test:e2e": "playwright test"
1415
},
1516
"dependencies": {
1617
"@theguild/components": "9.10.0",
@@ -23,6 +24,7 @@
2324
"unist-util-visit-parents": "^6.0.1"
2425
},
2526
"devDependencies": {
27+
"@playwright/test": "^1.49.1",
2628
"@theguild/tailwind-config": "0.6.4",
2729
"@types/node": "24.7.1",
2830
"@types/react": "19.2.2",

website/playwright.config.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { resolve } from 'node:path';
2+
import { defineConfig, devices } from '@playwright/test';
3+
4+
const __dirname = new URL('.', import.meta.url).pathname;
5+
6+
/**
7+
* @see https://playwright.dev/docs/test-configuration
8+
*/
9+
export default defineConfig({
10+
testDir: resolve(__dirname, 'test/e2e'),
11+
outputDir: resolve(__dirname, 'test/e2e/output'),
12+
fullyParallel: true,
13+
forbidOnly: !!process.env.CI,
14+
retries: process.env.CI ? 2 : 0,
15+
workers: process.env.CI ? 1 : undefined,
16+
reporter: 'html',
17+
use: {
18+
baseURL: 'http://localhost:3000',
19+
trace: 'on-first-retry',
20+
},
21+
22+
projects: [
23+
{
24+
name: 'chromium',
25+
use: { ...devices['Desktop Chrome'] },
26+
},
27+
],
28+
29+
webServer: {
30+
command: 'pnpm dev',
31+
url: 'http://localhost:3000',
32+
reuseExistingServer: !process.env.CI,
33+
},
34+
});

website/src/app/(landing-pages)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
ToolsAndLibrariesCards,
1515
YogaIcon,
1616
} from '@theguild/components';
17-
import { metadata as rootMetadata } from '../layout';
17+
import { rootMetadata } from '../metadata';
1818
import { PracticeYogaSection } from './practice-yoga-section';
1919
// import FAQ from './faq.mdx';
2020
import { ReachZenQuickerWithYoga } from './reach-zen-quicker-with-yoga';

website/src/app/global.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.light ::selection {
2+
@apply !bg-blue-500/20;
3+
}
4+
5+
body {
6+
--nextra-content-width: 92rem;
7+
}

website/src/app/layout.tsx

Lines changed: 83 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
11
import { FC, ReactNode } from 'react';
2-
import { GitHubIcon, PaperIcon, PencilIcon, PRODUCTS } from '@theguild/components';
3-
import { getDefaultMetadata, getPageMap, GuildLayout } from '@theguild/components/server';
2+
import localFont from 'next/font/local';
3+
import {
4+
Anchor,
5+
GitHubIcon,
6+
HiveFooter,
7+
HiveNavigation,
8+
ListIcon,
9+
PaperIcon,
10+
PencilIcon,
11+
PRODUCTS,
12+
YogaIcon,
13+
} from '@theguild/components';
14+
import { getPageMap, HiveLayout } from '@theguild/components/server';
415
import '@theguild/components/style.css';
516
import { pageMap as changelogsPageMap } from './changelogs/[...slug]/page';
17+
import { rootMetadata, websiteDescription } from './metadata';
618
import { pageMap as v2PageMap } from './v2/[[...slug]]/page';
719
import { pageMap as v3PageMap } from './v3/[[...slug]]/page';
820
import { pageMap as v4PageMap } from './v4/[[...slug]]/page';
921
import { VersionDropdown } from './version-dropdown.client';
1022
import { VersionedSearch } from './versioned-search';
23+
import './global.css';
24+
import { Metadata } from 'next';
1125

12-
const description = PRODUCTS.YOGA.title;
13-
const websiteName = 'Yoga';
26+
export const metadata: Metadata = rootMetadata;
1427

15-
export const metadata = getDefaultMetadata({
16-
description,
17-
websiteName,
18-
productName: 'YOGA',
28+
const neueMontreal = localFont({
29+
src: [
30+
{ path: '../fonts/PPNeueMontreal-Regular.woff2', weight: '400' },
31+
{ path: '../fonts/PPNeueMontreal-Medium.woff2', weight: '500' },
32+
// Medium is actually 530, so we use it both for 500 and 600
33+
{ path: '../fonts/PPNeueMontreal-Medium.woff2', weight: '600' },
34+
{ path: '../fonts/PPNeueMontreal-SemiBold.woff2', weight: '700' },
35+
],
1936
});
2037

2138
const RootLayout: FC<{
2239
children: ReactNode;
2340
}> = async ({ children }) => {
24-
let [meta, ...pageMap] = await getPageMap();
25-
pageMap = [
41+
let [meta, ..._pageMap] = await getPageMap();
42+
_pageMap = [
2643
{
2744
data: {
2845
// @ts-expect-error -- ignore
@@ -33,56 +50,71 @@ const RootLayout: FC<{
3350
v4: { type: 'page', title: 'Yoga 4 Docs' },
3451
},
3552
},
36-
...pageMap,
53+
..._pageMap,
3754
{ route: '/changelogs', name: 'changelogs', children: changelogsPageMap },
3855
{ route: '/v4', name: 'v4', children: v4PageMap },
3956
{ route: '/v3', name: 'v3', children: v3PageMap },
4057
{ route: '/v2', name: 'v2', children: v2PageMap },
4158
];
59+
4260
return (
43-
<GuildLayout
44-
htmlProps={{
45-
// Override nav width
46-
className: '[&>.light_#h-navmenu-container]:max-w-[1392px]',
47-
}}
48-
websiteName={websiteName}
49-
description={description}
50-
logo={<PRODUCTS.YOGA.logo className="w-8 h-auto" />}
51-
layoutProps={{
52-
docsRepositoryBase: 'https://github.com/graphql-hive/graphql-yoga/tree/main/website',
53-
}}
54-
pageMap={pageMap}
55-
navbarProps={{
56-
navLinks: [{ href: '/tutorial', children: 'Tutorial' }],
57-
developerMenu: [
58-
{
59-
href: '/docs',
60-
icon: <PaperIcon />,
61-
children: 'Documentation',
62-
},
63-
{
64-
href: 'https://the-guild.dev/graphql/hive/blog',
65-
icon: <PencilIcon />,
66-
children: 'Blog',
67-
},
68-
{
69-
href: 'https://github.com/graphql-hive/graphql-yoga',
70-
icon: <GitHubIcon />,
71-
children: 'GitHub',
72-
},
73-
{
74-
href: '/changelog',
75-
icon: null,
76-
children: 'Changelog',
77-
},
78-
],
79-
children: <VersionDropdown />,
80-
}}
81-
search={<VersionedSearch />}
61+
<HiveLayout
62+
className="[&>.light_#h-navmenu-container]:max-w-[1392px]"
63+
fontFamily={neueMontreal.style.fontFamily}
64+
docsRepositoryBase="https://github.com/graphql-hive/graphql-yoga/tree/main/website"
65+
head={null}
8266
lightOnlyPages={['/']}
67+
navbar={
68+
<HiveNavigation
69+
productName={PRODUCTS.YOGA.name}
70+
logo={
71+
<Anchor href="/" className="hive-focus -m-2 flex items-center rounded-md p-2 gap-2">
72+
<YogaIcon className="size-8 shrink-0" />
73+
<span className="text-2xl font-medium tracking-[-0.16px]">Yoga</span>
74+
</Anchor>
75+
}
76+
navLinks={[{ href: '/tutorial', children: 'Tutorial' }]}
77+
developerMenu={[
78+
{
79+
href: '/docs',
80+
icon: <PaperIcon />,
81+
children: 'Documentation',
82+
},
83+
{
84+
href: 'https://the-guild.dev/graphql/hive/blog',
85+
icon: <PencilIcon />,
86+
children: 'Blog',
87+
},
88+
{
89+
href: '/changelog',
90+
icon: <ListIcon />,
91+
children: 'Changelog',
92+
},
93+
{
94+
href: 'https://github.com/graphql-hive/graphql-yoga',
95+
icon: <GitHubIcon />,
96+
children: 'GitHub',
97+
},
98+
]}
99+
search={<VersionedSearch />}
100+
>
101+
<VersionDropdown />
102+
</HiveNavigation>
103+
}
104+
footer={
105+
<HiveFooter
106+
logo={
107+
<div className="flex gap-2">
108+
<YogaIcon className="size-8 shrink-0" />
109+
<span className="text-2xl font-medium tracking-[-0.16px]">Yoga</span>
110+
</div>
111+
}
112+
description={websiteDescription}
113+
/>
114+
}
83115
>
84116
{children}
85-
</GuildLayout>
117+
</HiveLayout>
86118
);
87119
};
88120

website/src/app/metadata.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { PRODUCTS } from '@theguild/components/products';
2+
import { getDefaultMetadata } from '@theguild/components/server';
3+
4+
export const websiteName = 'Yoga';
5+
export const websiteDescription = PRODUCTS.YOGA.title;
6+
7+
export const rootMetadata = getDefaultMetadata({
8+
description: websiteDescription,
9+
websiteName,
10+
productName: 'YOGA',
11+
});
50.8 KB
Binary file not shown.
46.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)