Skip to content

Commit a7352ee

Browse files
authored
feat(vercel): add analytics (#17)
1 parent fe8e272 commit a7352ee

4 files changed

Lines changed: 132 additions & 14 deletions

File tree

components/Layout/index.jsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import TableOfContents from '@node-core/ui-components/Common/TableOfContents';
2+
import Article from '@node-core/ui-components/Containers/Article';
3+
import { Analytics } from '@vercel/analytics/react';
4+
import { SpeedInsights } from '@vercel/speed-insights/react';
5+
6+
import NavBar from '../Navigation';
7+
import MetaBar from '../Metabar';
8+
import SideBar from '../Sidebar';
9+
10+
import Footer from '#theme/Footer';
11+
12+
/**
13+
* @typedef {Object} Props
14+
* @property {import('@node-core/doc-kit/src/generators/web/ui/types.d.ts').SerializedMetadata} metadata
15+
* @property {Array} headings
16+
* @property {string} readingTime
17+
* @property {import('preact').ComponentChildren} children
18+
*/
19+
20+
/**
21+
* @param {Props} props
22+
*/
23+
export default ({ metadata, headings, readingTime, children }) => (
24+
<>
25+
<Analytics />
26+
<SpeedInsights />
27+
<NavBar />
28+
<Article>
29+
<SideBar metadata={metadata} />
30+
<div>
31+
<div>
32+
<TableOfContents headings={headings} summaryTitle="On this page" />
33+
<br />
34+
<main>{children}</main>
35+
</div>
36+
<MetaBar
37+
metadata={metadata}
38+
headings={headings}
39+
readingTime={readingTime}
40+
/>
41+
</div>
42+
</Article>
43+
<Footer />
44+
</>
45+
);

doc-kit.config.mjs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,7 @@ export default {
1313
editURL: 'https://github.com/nodejs/learn/edit/main/pages{path}.md',
1414
imports: {
1515
...web.defaultConfiguration.imports,
16-
'#theme/Navigation': join(
17-
import.meta.dirname,
18-
'components/Navigation/index.jsx'
19-
),
20-
'#theme/Sidebar': join(
21-
import.meta.dirname,
22-
'components/Sidebar/index.jsx'
23-
),
24-
'#theme/Metabar': join(
25-
import.meta.dirname,
26-
'components/Metabar/index.jsx'
27-
),
16+
'#theme/Layout': join(import.meta.dirname, 'components/Layout/index.jsx'),
2817
},
2918
},
3019
};

package-lock.json

Lines changed: 83 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
"typescript-eslint": "^8.57.2"
2222
},
2323
"dependencies": {
24-
"@node-core/ui-components": "^1.6.3"
24+
"@node-core/ui-components": "^1.6.3",
25+
"@vercel/analytics": "^2.0.1",
26+
"@vercel/speed-insights": "^2.0.0"
2527
},
2628
"engines": {
2729
"node": "24.x"

0 commit comments

Comments
 (0)