Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix header for pidgin #385

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ const NavMenuMain = styled.div`
height: 40px;
padding: 0 20px;
color: #222;
line-height: 1.1;

body.dark-mode & {
color: #FFF;
Expand Down Expand Up @@ -641,7 +642,13 @@ const ButtonsWrapper = styled.div`
}

a {
padding: 8px 32px !important;
line-height: 1.1;
}

html:not([lang='pcm-NG']) & {
a {
padding: 8px 32px !important;
}
}

&.download-btn-desktop {
Expand Down
3 changes: 2 additions & 1 deletion src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const Layout = props => {
themeColor,
widerContainer,
locale,
previewMode,
} = props
const data = useStaticQuery(
graphql`
Expand Down Expand Up @@ -57,7 +58,7 @@ const Layout = props => {
},
]}
>
<html lang={mapCodeToHtmlLang(locale)} />
<html lang={mapCodeToHtmlLang(locale, previewMode)} />
</Helmet>
{children}
</Wrapper>
Expand Down
5 changes: 3 additions & 2 deletions src/lib/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ export const LOCALES_TRANSLATE = LOCALES.slice(1)
export const DEFAULT_LOCALE = LOCALES[0]
export const DEFAULT_LOCALE_CODE = DEFAULT_LOCALE.code

export const mapCodeToHtmlLang = code => {
const locale = LOCALES.find(l => l.code === code)
export const mapCodeToHtmlLang = (code, previewMode) => {
const listLocales = previewMode ? PREVIEW_LOCALES : LOCALES
const locale = listLocales.find(l => l.code === code)
return locale ? locale.htmlLang : DEFAULT_LOCALE.htmlLang
}

Expand Down
1 change: 1 addition & 0 deletions src/pages/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ const PreviewPage = () => {
widerContainer={moduleConfig?.widerContainer}
locale={locale.code}
sharedCopy={sharedCopy}
previewMode
>
<PreviewInfo>Preview mode</PreviewInfo>
{contentfulModuleToComponent(moduleConfig)}
Expand Down
Loading