Skip to content

Commit 056fc88

Browse files
dobromirtsChronosSFCopilot
authored
fix(subheader): wire platform navigation (#205)
* fix(subheader): wire platform navigation * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * feat(*): updating to 0.0.13 to bring the platform dropdown --------- Co-authored-by: Stamen Stoychev <sstoychev@infragistics.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent cc7103f commit 056fc88

8 files changed

Lines changed: 56 additions & 13 deletions

File tree

docs/angular/astro.config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ if (docsEnv !== 'development' && docsEnv !== 'staging' && docsEnv !== 'productio
3232
const mode: DocsMode = docsEnv;
3333

3434
// ── Site URL — varies by build mode ─────────────────────────────────────────
35-
const PROD_HOST = 'https://www.infragistics.com';
36-
const STAGING_HOST = 'https://staging.infragistics.com';
35+
const PROD_HOST = docsLang === 'jp' ? 'https://jp.infragistics.com' : 'https://www.infragistics.com';
36+
const STAGING_HOST = docsLang === 'jp' ? 'https://jp.staging.infragistics.com' : 'https://staging.infragistics.com';
3737

3838
const platformKey = docsLang === 'jp' ? 'AngularJP' : 'Angular';
3939
const { base } = IGDOCS_PLATFORMS[platformKey];
@@ -69,6 +69,14 @@ export default createDocsSite({
6969
href: mode === 'production' ? `${PROD_HOST}${b}` : `${STAGING_HOST}${b}`,
7070
platform: key,
7171
})),
72+
packages: Object.values(IGDOCS_PLATFORMS)
73+
.filter(p => p.lang === docsLang)
74+
.map(({ label, key, base: b }) => ({
75+
label,
76+
value: key,
77+
href: mode === 'production' ? `${PROD_HOST}${b}/` : `${STAGING_HOST}${b}/`,
78+
})),
79+
selectedPackage: 'angular',
7280
source: {
7381
tocPath: `${componentsDocsDir}/toc.json`,
7482
docsDir: componentsDocsDir,

docs/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dependencies": {
3838
"astro": "^6.1.6",
3939
"docs-template": "file:../../",
40-
"igniteui-astro-components": "0.0.12",
40+
"igniteui-astro-components": "0.0.13",
4141
"sharp": "^0.34.2"
4242
},
4343
"devDependencies": {

docs/xplat/astro.config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ function buildFilteredToc(): string {
318318
const filteredTocPath = buildFilteredToc();
319319

320320
console.log(`[astro.config] Platform: ${platform} lang: ${lang} mode: ${mode}`);
321-
const PROD_HOST = 'https://www.infragistics.com';
322-
const STAGING_HOST = 'https://staging.infragistics.com';
321+
const PROD_HOST = lang === 'jp' ? 'https://jp.infragistics.com' : 'https://www.infragistics.com';
322+
const STAGING_HOST = lang === 'jp' ? 'https://jp.staging.infragistics.com' : 'https://staging.infragistics.com';
323323

324324
const platformLangKey = lang === 'jp' ? `${platform}JP` : platform;
325325
const p = PLATFORMS[platformLangKey] ?? PLATFORMS[platform];
@@ -354,6 +354,14 @@ export default createDocsSite({
354354
href: mode === 'production' ? `${PROD_HOST}${b}` : `${STAGING_HOST}${b}`,
355355
platform: key,
356356
})),
357+
packages: Object.values(PLATFORMS)
358+
.filter(p => p.lang === lang)
359+
.map(({ label, key, base: b }) => ({
360+
label,
361+
value: key,
362+
href: mode === 'production' ? `${PROD_HOST}${b}/` : `${STAGING_HOST}${b}/`,
363+
})),
364+
selectedPackage: p.key,
357365
head: [
358366
{ tag: 'link', attrs: { rel: 'icon', href: `${mode !== 'development' ? p.base : ''}/favicon.ico`, type: 'image/x-icon' } },
359367
],

docs/xplat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"dependencies": {
6868
"astro": "^6.1.6",
6969
"docs-template": "file:../../",
70-
"igniteui-astro-components": "0.0.12",
70+
"igniteui-astro-components": "0.0.13",
7171
"sharp": "^0.34.2"
7272
},
7373
"devDependencies": {

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"@astrojs/check": "^0.9.8",
112112
"@astrojs/mdx": ">=5",
113113
"gray-matter": "^4.0.3",
114-
"igniteui-astro-components": "0.0.12",
114+
"igniteui-astro-components": "0.0.13",
115115
"js-yaml": "^4.1.1",
116116
"jsdom": "^29.0.1",
117117
"pagefind": "^1.5.2"

src/integration.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ export interface SiteMetaOptions {
135135
* module and rendered by `MainLayout.astro`.
136136
*/
137137
head?: HeadEntry[];
138+
/**
139+
* Items for the DocsSubHeader package/platform selector.
140+
* The selector is hidden when there are no package options to render
141+
* (for example, when `packages` is omitted or an empty array).
142+
*/
143+
packages?: Array<string | { label: string; value?: string; href?: string }>;
144+
/**
145+
* Initially selected package value. Must match one of `packages`;
146+
* ignored when no package options are available.
147+
*/
148+
selectedPackage?: string;
138149
}
139150

140151
/**
@@ -176,6 +187,8 @@ export function siteMetaIntegration({
176187
llmsSets = [],
177188
productLinks = [],
178189
head = [],
190+
packages = [],
191+
selectedPackage = '',
179192
}: SiteMetaOptions = {} as SiteMetaOptions): AstroIntegration {
180193
const llmsMetaMap = docsDir
181194
? buildLlmsMetaMap(docsDir, sidebar ?? [])
@@ -253,6 +266,8 @@ export const productLinks = ${JSON.stringify(productLinks)};
253266
export const headEntries = ${JSON.stringify(head ?? [])};
254267
export const trailingSlash = ${JSON.stringify(configuredTrailingSlash)};
255268
export const navLang = ${JSON.stringify(navLang)};
269+
export const packages = ${JSON.stringify(packages)};
270+
export const selectedPackage = ${JSON.stringify(selectedPackage)};
256271
`;
257272
if (id !== navResolvedId) return;
258273

@@ -510,6 +525,10 @@ export interface CreateDocsSiteOptions {
510525
llmsSets?: LlmsSet[];
511526
/** Cross-product navigation links rendered in the DocsSubHeader. */
512527
productLinks?: ProductLink[];
528+
/** Items for the DocsSubHeader package/platform selector. When `packages` is empty, the selector is hidden. */
529+
packages?: Array<string | { label: string; value?: string; href?: string }>;
530+
/** Initially selected package value when `packages` is provided (must match one of `packages`). */
531+
selectedPackage?: string;
513532
/** Extra Astro integrations appended after the built-in ones. */
514533
integrations?: AstroIntegration[];
515534
/** Any remaining keys are spread into `defineConfig` (markdown, image, build, …). */
@@ -535,6 +554,8 @@ export function createDocsSite(options: CreateDocsSiteOptions = {} as CreateDocs
535554
navLang = 'en',
536555
mode = 'development',
537556
productLinks = [],
557+
packages = [],
558+
selectedPackage = '',
538559
head = [],
539560
llmsSets = [] as LlmsSet[],
540561
integrations: extraIntegrations = [],
@@ -646,6 +667,8 @@ export function createDocsSite(options: CreateDocsSiteOptions = {} as CreateDocs
646667
mode,
647668
llmsSets,
648669
productLinks,
670+
packages,
671+
selectedPackage,
649672
head: [...platformHead, ...codeViewHead, ...head],
650673
}),
651674
...(base ? [createBasePrependIntegration(base)] : []),

src/virtual-modules.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ declare module 'virtual:docs-template/site-meta' {
1818
export const trailingSlash: 'always' | 'never' | 'ignore';
1919
/** Locale for the nav prefetch URL. Mirrors the value on `virtual:docs-template/nav-html`. */
2020
export const navLang: NavLang;
21+
/** Items for the DocsSubHeader package/platform selector. Empty array when not configured. */
22+
export const packages: Array<string | { label: string; value?: string; href?: string }>;
23+
/** Initially selected package. Empty string when not configured. */
24+
export const selectedPackage: string;
2125
}
2226

2327
declare module 'virtual:docs-template/nav-html' {

0 commit comments

Comments
 (0)