Skip to content

Commit 829c587

Browse files
committed
refactor: review
1 parent 43fabd8 commit 829c587

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/generators/jsx-ast/index.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export default {
2323

2424
defaultConfiguration: {
2525
ref: 'main',
26+
remoteConfig:
27+
'https://raw.githubusercontent.com/nodejs/nodejs.org/main/apps/site/site.json',
2628
},
2729

2830
/**

src/generators/jsx-ast/utils/buildContent.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,13 @@ export const createDocumentLayout = (
285285
sideBarProps,
286286
metaBarProps,
287287
remark
288-
) =>
289-
createTree('root', [
288+
) => {
289+
const config = getConfig('jsx-ast');
290+
291+
return createTree('root', [
290292
createJSXElement(JSX_IMPORTS.AnnouncementBanner.name, {
291-
remoteConfig: getConfig('web').remoteConfig,
292-
versionMajor: getConfig('web').version?.major ?? null,
293+
remoteConfig: config.remoteConfig,
294+
versionMajor: config.version?.major ?? null,
293295
}),
294296
createJSXElement(JSX_IMPORTS.NavBar.name),
295297
createJSXElement(JSX_IMPORTS.Article.name, {
@@ -312,6 +314,7 @@ export const createDocumentLayout = (
312314
],
313315
}),
314316
]);
317+
};
315318

316319
/**
317320
* @typedef {import('estree').Node & { data: ApiDocMetadataEntry }} JSXContent

src/generators/web/index.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ export default {
3434
imports: {
3535
'#config/Logo': '@node-core/ui-components/Common/NodejsLogo',
3636
},
37-
remoteConfig:
38-
'https://raw.githubusercontent.com/nodejs/nodejs.org/main/apps/site/site.json',
3937
},
4038

4139
/**

src/generators/web/ui/components/AnnouncementBanner/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ export default ({ remoteConfig, versionMajor }) => {
3434

3535
const active = [];
3636

37-
const globalBanner = config.global?.banner;
37+
const globalBanner = config.websiteBanners?.index;
3838
if (globalBanner && isBannerActive(globalBanner)) {
3939
active.push(globalBanner);
4040
}
4141

4242
if (versionMajor != null) {
43-
const versionBanner = config[`v${versionMajor}`]?.banner;
43+
const versionBanner = config.websiteBanners[`v${versionMajor}`];
4444
if (versionBanner && isBannerActive(versionBanner)) {
4545
active.push(versionBanner);
4646
}
@@ -64,11 +64,11 @@ export default ({ remoteConfig, versionMajor }) => {
6464
{banner.link ? (
6565
<a href={banner.link} target="_blank" rel="noopener noreferrer">
6666
{banner.text}
67-
<ArrowUpRightIcon />
6867
</a>
6968
) : (
7069
banner.text
7170
)}
71+
{banner.link && <ArrowUpRightIcon />}
7272
</Banner>
7373
))}
7474
</div>

0 commit comments

Comments
 (0)