Skip to content

Commit 2ae732d

Browse files
authored
BACKLOG-23514: fixed language switch not showing (#91)
1 parent 7c2560b commit 2ae732d

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

src/server/layouts/MainLayout.jsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import {HtmlFooter, HtmlHead} from '../components';
4-
import {AbsoluteArea, AddResources} from '@jahia/javascript-modules-library';
5-
6-
// Const navMenu = {
7-
// name: 'navMenu',
8-
// nodeType: 'luxe:navMenu',
9-
// mixins: ['jmix:renderable'],
10-
// properties: {
11-
// base: 'home',
12-
// maxDepth: '2',
13-
// startLevel: '0',
14-
// menuItemView: 'menuElement'
15-
// }
16-
// };
4+
import {AbsoluteArea, AddResources, useUrlBuilder} from '@jahia/javascript-modules-library';
175

186
export const MainLayout = ({head, className, children}) => {
19-
// Const {renderContext} = useServerContext();
20-
// navMainArea.path = `/sites/${renderContext.getSite().getName()}`;
7+
const {buildStaticUrl} = useUrlBuilder();
8+
const bootstrap = buildStaticUrl({assetPath: 'javascript/bootstrap.bundle.min.js'});
219
return (
2210
<>
2311
<HtmlHead>
@@ -29,7 +17,7 @@ export const MainLayout = ({head, className, children}) => {
2917
{children}
3018
</main>
3119
<HtmlFooter/>
32-
<AddResources type="javascript" resources="bootstrap.bundle.min.js"/>
20+
<AddResources type="javascript" resources={bootstrap}/>
3321
</body>
3422
</>
3523
);

src/server/views/navMenu/LanguageSwitcher.jsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import clsx from 'clsx';
44

55
const getSiteLanguageAsLocales = renderContext => {
66
const site = renderContext.getSite();
7-
switch (true) {
8-
case renderContext.isLiveMode():
9-
return site.getActiveLiveLanguagesAsLocales().toArray();
107

11-
default:
12-
return site.getLanguagesAsLocales().toArray();
8+
if (renderContext.isLiveMode()) {
9+
return site.getActiveLiveLanguagesAsLocales().toArray();
1310
}
11+
12+
return site.getLanguagesAsLocales().toArray();
1413
};
1514

1615
export const LanguageSwitcher = () => {
@@ -32,7 +31,7 @@ export const LanguageSwitcher = () => {
3231
>
3332
{currentLocaleName}
3433
</button>
35-
<ul className="dropdown-menu">
34+
<ul className="dropdown-menu dropdown-menu-end">
3635
{siteLocales?.map(locale => {
3736
const localeCode = locale.getLanguage();
3837
const localeName = locale.getDisplayLanguage(locale);

0 commit comments

Comments
 (0)