From 07b8b08e6769e15c9a7b24690b9f80c552512a36 Mon Sep 17 00:00:00 2001
From: viphan007
Date: Mon, 10 Jun 2024 15:32:09 +0700
Subject: [PATCH] Fix header for pidgin
---
src/components/Header.js | 9 ++++++++-
src/components/layout.js | 3 ++-
src/lib/config.mjs | 5 +++--
src/pages/preview.js | 1 +
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/components/Header.js b/src/components/Header.js
index af78c770ede..153d46b18c1 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -583,6 +583,7 @@ const NavMenuMain = styled.div`
height: 40px;
padding: 0 20px;
color: #222;
+ line-height: 1.1;
body.dark-mode & {
color: #FFF;
@@ -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 {
diff --git a/src/components/layout.js b/src/components/layout.js
index 1d6574a0751..a5d6d1a8c8f 100644
--- a/src/components/layout.js
+++ b/src/components/layout.js
@@ -17,6 +17,7 @@ const Layout = props => {
themeColor,
widerContainer,
locale,
+ previewMode,
} = props
const data = useStaticQuery(
graphql`
@@ -57,7 +58,7 @@ const Layout = props => {
},
]}
>
-
+
{children}
diff --git a/src/lib/config.mjs b/src/lib/config.mjs
index f1a61b5f614..48253f75ea1 100644
--- a/src/lib/config.mjs
+++ b/src/lib/config.mjs
@@ -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
}
diff --git a/src/pages/preview.js b/src/pages/preview.js
index c3a781038ea..1e3c01a05ac 100644
--- a/src/pages/preview.js
+++ b/src/pages/preview.js
@@ -196,6 +196,7 @@ const PreviewPage = () => {
widerContainer={moduleConfig?.widerContainer}
locale={locale.code}
sharedCopy={sharedCopy}
+ previewMode
>
Preview mode
{contentfulModuleToComponent(moduleConfig)}