@docusaurus/theme-classic 0.0.0-5488 → 0.0.0-5489

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,15 +32,34 @@ function getNavbarTranslationFile(navbar) {
32
32
  const titleTranslations = navbar.title
33
33
  ? { title: { message: navbar.title, description: 'The title in the navbar' } }
34
34
  : {};
35
- return (0, utils_1.mergeTranslations)([titleTranslations, navbarItemsTranslations]);
35
+ const logoAlt = navbar.logo?.alt
36
+ ? {
37
+ 'logo.alt': {
38
+ message: navbar.logo.alt,
39
+ description: 'The alt text of navbar logo',
40
+ },
41
+ }
42
+ : {};
43
+ return (0, utils_1.mergeTranslations)([
44
+ titleTranslations,
45
+ logoAlt,
46
+ navbarItemsTranslations,
47
+ ]);
36
48
  }
37
49
  function translateNavbar(navbar, navbarTranslations) {
38
50
  if (!navbarTranslations) {
39
51
  return navbar;
40
52
  }
53
+ const logo = navbar.logo
54
+ ? {
55
+ ...navbar.logo,
56
+ alt: navbarTranslations[`logo.alt`]?.message ?? navbar.logo?.alt,
57
+ }
58
+ : undefined;
41
59
  return {
42
60
  ...navbar,
43
61
  title: navbarTranslations.title?.message ?? navbar.title,
62
+ logo,
44
63
  // TODO handle properly all the navbar item types here!
45
64
  items: navbar.items.map((item) => {
46
65
  const subItems = item.items?.map((subItem) => ({
@@ -86,7 +105,20 @@ function getFooterTranslationFile(footer) {
86
105
  },
87
106
  }
88
107
  : {};
89
- return (0, utils_1.mergeTranslations)([footerLinkTitles, footerLinkLabels, copyright]);
108
+ const logoAlt = footer.logo?.alt
109
+ ? {
110
+ 'logo.alt': {
111
+ message: footer.logo.alt,
112
+ description: 'The alt text of footer logo',
113
+ },
114
+ }
115
+ : {};
116
+ return (0, utils_1.mergeTranslations)([
117
+ footerLinkTitles,
118
+ footerLinkLabels,
119
+ copyright,
120
+ logoAlt,
121
+ ]);
90
122
  }
91
123
  function translateFooter(footer, footerTranslations) {
92
124
  if (!footerTranslations) {
@@ -108,10 +140,17 @@ function translateFooter(footer, footerTranslations) {
108
140
  link.label,
109
141
  }));
110
142
  const copyright = footerTranslations.copyright?.message ?? footer.copyright;
143
+ const logo = footer.logo
144
+ ? {
145
+ ...footer.logo,
146
+ alt: footerTranslations[`logo.alt`]?.message ?? footer.logo?.alt,
147
+ }
148
+ : undefined;
111
149
  return {
112
150
  ...footer,
113
151
  links,
114
152
  copyright,
153
+ logo,
115
154
  };
116
155
  }
117
156
  function getTranslationFiles({ themeConfig, }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5488",
3
+ "version": "0.0.0-5489",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,18 +20,18 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "0.0.0-5488",
24
- "@docusaurus/mdx-loader": "0.0.0-5488",
25
- "@docusaurus/module-type-aliases": "0.0.0-5488",
26
- "@docusaurus/plugin-content-blog": "0.0.0-5488",
27
- "@docusaurus/plugin-content-docs": "0.0.0-5488",
28
- "@docusaurus/plugin-content-pages": "0.0.0-5488",
29
- "@docusaurus/theme-common": "0.0.0-5488",
30
- "@docusaurus/theme-translations": "0.0.0-5488",
31
- "@docusaurus/types": "0.0.0-5488",
32
- "@docusaurus/utils": "0.0.0-5488",
33
- "@docusaurus/utils-common": "0.0.0-5488",
34
- "@docusaurus/utils-validation": "0.0.0-5488",
23
+ "@docusaurus/core": "0.0.0-5489",
24
+ "@docusaurus/mdx-loader": "0.0.0-5489",
25
+ "@docusaurus/module-type-aliases": "0.0.0-5489",
26
+ "@docusaurus/plugin-content-blog": "0.0.0-5489",
27
+ "@docusaurus/plugin-content-docs": "0.0.0-5489",
28
+ "@docusaurus/plugin-content-pages": "0.0.0-5489",
29
+ "@docusaurus/theme-common": "0.0.0-5489",
30
+ "@docusaurus/theme-translations": "0.0.0-5489",
31
+ "@docusaurus/types": "0.0.0-5489",
32
+ "@docusaurus/utils": "0.0.0-5489",
33
+ "@docusaurus/utils-common": "0.0.0-5489",
34
+ "@docusaurus/utils-validation": "0.0.0-5489",
35
35
  "@mdx-js/react": "^1.6.22",
36
36
  "clsx": "^1.2.1",
37
37
  "copy-text-to-clipboard": "^3.0.1",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=16.14"
64
64
  },
65
- "gitHead": "1cabce50d0e44edb26663525aefedf6a75ac2046"
65
+ "gitHead": "7027a5788ae1eb95026633af7434e349561988e5"
66
66
  }
@@ -45,7 +45,20 @@ function getNavbarTranslationFile(navbar: Navbar): TranslationFileContent {
45
45
  ? {title: {message: navbar.title, description: 'The title in the navbar'}}
46
46
  : {};
47
47
 
48
- return mergeTranslations([titleTranslations, navbarItemsTranslations]);
48
+ const logoAlt: TranslationFileContent = navbar.logo?.alt
49
+ ? {
50
+ 'logo.alt': {
51
+ message: navbar.logo.alt,
52
+ description: 'The alt text of navbar logo',
53
+ },
54
+ }
55
+ : {};
56
+
57
+ return mergeTranslations([
58
+ titleTranslations,
59
+ logoAlt,
60
+ navbarItemsTranslations,
61
+ ]);
49
62
  }
50
63
  function translateNavbar(
51
64
  navbar: Navbar,
@@ -54,9 +67,18 @@ function translateNavbar(
54
67
  if (!navbarTranslations) {
55
68
  return navbar;
56
69
  }
70
+
71
+ const logo = navbar.logo
72
+ ? {
73
+ ...navbar.logo,
74
+ alt: navbarTranslations[`logo.alt`]?.message ?? navbar.logo?.alt,
75
+ }
76
+ : undefined;
77
+
57
78
  return {
58
79
  ...navbar,
59
80
  title: navbarTranslations.title?.message ?? navbar.title,
81
+ logo,
60
82
  // TODO handle properly all the navbar item types here!
61
83
  items: navbar.items.map((item) => {
62
84
  const subItems = item.items?.map((subItem) => ({
@@ -119,7 +141,21 @@ function getFooterTranslationFile(footer: Footer): TranslationFileContent {
119
141
  }
120
142
  : {};
121
143
 
122
- return mergeTranslations([footerLinkTitles, footerLinkLabels, copyright]);
144
+ const logoAlt: TranslationFileContent = footer.logo?.alt
145
+ ? {
146
+ 'logo.alt': {
147
+ message: footer.logo.alt,
148
+ description: 'The alt text of footer logo',
149
+ },
150
+ }
151
+ : {};
152
+
153
+ return mergeTranslations([
154
+ footerLinkTitles,
155
+ footerLinkLabels,
156
+ copyright,
157
+ logoAlt,
158
+ ]);
123
159
  }
124
160
  function translateFooter(
125
161
  footer: Footer,
@@ -149,10 +185,18 @@ function translateFooter(
149
185
 
150
186
  const copyright = footerTranslations.copyright?.message ?? footer.copyright;
151
187
 
188
+ const logo = footer.logo
189
+ ? {
190
+ ...footer.logo,
191
+ alt: footerTranslations[`logo.alt`]?.message ?? footer.logo?.alt,
192
+ }
193
+ : undefined;
194
+
152
195
  return {
153
196
  ...footer,
154
197
  links,
155
198
  copyright,
199
+ logo,
156
200
  };
157
201
  }
158
202