Skip to content

Commit 7666e25

Browse files
committed
fix: standardize image paths and refine type declarations
- Updated image paths from `/img` to `img` for consistency across config and docs files. - Refined `position` property in navigation items with `as const` to ensure strict type safety. - Adjusted standards list URLs to be computed at render time using updated environment logic.
1 parent 8a13bec commit 7666e25

File tree

13 files changed

+42
-38
lines changed

13 files changed

+42
-38
lines changed

portal/docusaurus.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,18 @@ const config: Config = {
100100
items: [
101101
...navbarItems,
102102
standardsDropdown(currentEnv),
103-
{ to: '/blog', label: 'Blog', position: 'right' },
103+
{ to: '/blog', label: 'Blog', position: 'right' as const },
104104
{
105105
type: 'docsVersionDropdown',
106-
position: 'right',
106+
position: 'right' as const,
107107
},
108108
{
109109
type: 'localeDropdown',
110-
position: 'right',
110+
position: 'right' as const,
111111
},
112112
{
113113
type: 'search',
114-
position: 'right',
114+
position: 'right' as const,
115115
},
116116
],
117117
},
@@ -150,7 +150,7 @@ const config: Config = {
150150
copyright: `
151151
Copyright © ${new Date().getFullYear()} International Federation of Library Associations and Institutions (IFLA)<br />
152152
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener noreferrer">
153-
<img src="/img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
153+
<img src="img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
154154
</a>
155155
Gordon Dunsire and Mirna Willer (Main design and content editors).
156156
`,

portal/navbar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ export default [
33
{
44
type: 'docSidebar',
55
sidebarId: 'tutorialSidebar',
6-
position: 'left',
6+
position: 'left' as const,
77
label: 'Documentation',
88
},
99
{
1010
to: '/blog',
1111
label: 'Blog',
12-
position: 'left'
12+
position: 'left' as const,
1313
},
1414
{
1515
to: '/manage',
1616
label: 'Management',
17-
position: 'left',
17+
position: 'left' as const,
1818
className: 'navbar__item--management',
1919
},
2020
];

portal/src/components/HomepageFeatures/index.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import {JSX, ReactNode} from 'react';
22
import clsx from 'clsx';
33
import Heading from '@theme/Heading';
44
import Link from '@docusaurus/Link';
5+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
56
import styles from './styles.module.css';
67
import { getSiteUrl, type SiteKey } from '@ifla/theme/config/siteConfig';
7-
import { getCurrentEnv } from '@ifla/theme/config/siteConfig.server';
8+
import { DocsEnv } from '@ifla/theme/config/siteConfigCore';
89

910
type StandardItem = {
1011
title: string;
@@ -15,10 +16,8 @@ type StandardItem = {
1516
href: string; // Pre-computed URL
1617
};
1718

18-
// Get current environment at build time
19-
const currentEnv = getCurrentEnv();
20-
21-
const StandardsList: StandardItem[] = [
19+
// Define the standards list data without hrefs (to be computed at render time)
20+
const StandardsListData = [
2221
{
2322
title: 'ISBD for Manifestation (ISBDM)',
2423
code: 'ISBDM',
@@ -29,8 +28,7 @@ const StandardsList: StandardItem[] = [
2928
</>
3029
),
3130
siteKey: 'ISBDM' as SiteKey,
32-
status: 'published',
33-
href: getSiteUrl('ISBDM' as SiteKey, '', currentEnv),
31+
status: 'published' as const,
3432
},
3533
{
3634
title: 'Library Reference Model (LRM)',
@@ -42,8 +40,7 @@ const StandardsList: StandardItem[] = [
4240
</>
4341
),
4442
siteKey: 'LRM' as SiteKey,
45-
status: 'published',
46-
href: getSiteUrl('LRM' as SiteKey, '', currentEnv),
43+
status: 'published' as const,
4744
},
4845
{
4946
title: 'International Standard Bibliographic Description (ISBD)',
@@ -55,8 +52,7 @@ const StandardsList: StandardItem[] = [
5552
</>
5653
),
5754
siteKey: 'isbd' as SiteKey,
58-
status: 'development',
59-
href: getSiteUrl('isbd' as SiteKey, '', currentEnv),
55+
status: 'development' as const,
6056
},
6157
{
6258
title: 'Functional Requirements (FR)',
@@ -68,8 +64,7 @@ const StandardsList: StandardItem[] = [
6864
</>
6965
),
7066
siteKey: 'FRBR' as SiteKey,
71-
status: 'development',
72-
href: getSiteUrl('FRBR' as SiteKey, '', currentEnv),
67+
status: 'development' as const,
7368
},
7469
{
7570
title: 'Multilingual Dictionary of Cataloguing Terms (MulDiCat)',
@@ -81,8 +76,7 @@ const StandardsList: StandardItem[] = [
8176
</>
8277
),
8378
siteKey: 'muldicat' as SiteKey,
84-
status: 'development',
85-
href: getSiteUrl('muldicat' as SiteKey, '', currentEnv),
79+
status: 'development' as const,
8680
},
8781
{
8882
title: 'UNIMARC',
@@ -94,8 +88,7 @@ const StandardsList: StandardItem[] = [
9488
</>
9589
),
9690
siteKey: 'unimarc' as SiteKey,
97-
status: 'development',
98-
href: getSiteUrl('unimarc' as SiteKey, '', currentEnv),
91+
status: 'development' as const,
9992
},
10093
];
10194

@@ -130,6 +123,17 @@ function StandardCard({title, code, description, href, status}: StandardItem) {
130123
}
131124

132125
export default function HomepageFeatures(): JSX.Element {
126+
const { siteConfig: { customFields } } = useDocusaurusContext();
127+
128+
// Get current environment from Docusaurus customFields
129+
const currentEnv = (customFields?.docsEnv as DocsEnv) || DocsEnv.Production;
130+
131+
// Generate standards list with URLs computed at render time
132+
const StandardsList: StandardItem[] = StandardsListData.map(item => ({
133+
...item,
134+
href: getSiteUrl(item.siteKey, '', currentEnv),
135+
}));
136+
133137
return (
134138
<section className={styles.features} id="standards">
135139
<div className="container">

standards/FRBR/docs/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ This page introduces the FRBR Element Sets and Value Vocabularies.
9494
<div className="m-1 p-0">
9595
<OutLink to="https://creativecommons.org/licenses/by/4.0/" className="me-1">
9696
<Figure
97-
src="/img/cc0_by.png"
97+
src="img/cc0_by.png"
9898
alt="Badge for Creative Commons Attribution 4.0 International license"
9999
caption=""
100100
/>
101101
</OutLink>
102102
<p className="m-0">IFLA Working Groups (Main design and content editors).</p>
103103
</div>
104-
</div>
104+
</div>

standards/FRBR/docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const config: Config = {
169169
copyright: `
170170
Copyright © ${new Date().getFullYear()} International Federation of Library Associations and Institutions (IFLA)<br />
171171
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener noreferrer">
172-
<img src="/img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
172+
<img src="img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
173173
</a>
174174
Gordon Dunsire and Mirna Willer (Main design and content editors).
175175
`,

standards/ISBDM/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ import { QuickStart, DownloadPanel } from '@ifla/theme';
101101
<div className="m-1 p-0">
102102
<OutLink to="https://creativecommons.org/licenses/by/4.0/" className="me-1">
103103
<Figure
104-
src="/img/cc0_by.png"
104+
src="img/cc0_by.png"
105105
alt="Badge for Creative Commons Attribution 4.0 International license"
106106
caption=""
107107
/>

standards/ISBDM/docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const config: Config = {
222222
copyright: `
223223
Copyright © ${new Date().getFullYear()} International Federation of Library Associations and Institutions (IFLA)<br />
224224
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener noreferrer">
225-
<img src="/img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
225+
<img src="img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
226226
</a>
227227
Gordon Dunsire and Mirna Willer (Main design and content editors).
228228
`,

standards/LRM/docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const config: Config = {
165165
copyright: `
166166
Copyright © ${new Date().getFullYear()} International Federation of Library Associations and Institutions (IFLA)<br />
167167
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener noreferrer">
168-
<img src="/img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
168+
<img src="img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
169169
</a>
170170
Gordon Dunsire and Mirna Willer (Main design and content editors).
171171
`,

standards/isbd/docs/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ The ISBD element set vocabulary includes RDF classes and properties correspondin
102102
<div className="m-1 p-0">
103103
<OutLink to="https://creativecommons.org/licenses/by/4.0/" className="me-1">
104104
<Figure
105-
src="/img/cc0_by.png"
105+
src="img/cc0_by.png"
106106
alt="Badge for Creative Commons Attribution 4.0 International license"
107107
caption=""
108108
/>
109109
</OutLink>
110110
<p className="m-0">ISBD Review Group (Main design and content editors).</p>
111111
</div>
112-
</div>
112+
</div>

standards/isbd/docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const config: Config = {
169169
copyright: `
170170
Copyright © ${new Date().getFullYear()} International Federation of Library Associations and Institutions (IFLA)<br />
171171
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="noopener noreferrer">
172-
<img src="/img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
172+
<img src="img/cc0_by.png" alt="CC BY 4.0" style="vertical-align:middle; height:24px;" />
173173
</a>
174174
Gordon Dunsire and Mirna Willer (Main design and content editors).
175175
`,

0 commit comments

Comments
 (0)