From 01432266ef58ff232599ca2d4a383235a904612b Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 11 Sep 2020 13:21:17 -0700 Subject: [PATCH] Load fonts only for specific locale changes. --- components/common/LanguageButton.js | 45 ++++++++++++++++++++--------- components/layout/Layout.js | 4 --- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/components/common/LanguageButton.js b/components/common/LanguageButton.js index 76154e24..74c55ba3 100644 --- a/components/common/LanguageButton.js +++ b/components/common/LanguageButton.js @@ -1,4 +1,5 @@ import React, { useState, useRef } from 'react'; +import Head from 'next/head'; import Globe from 'assets/globe.svg'; import useDocumentClick from 'hooks/useDocumentClick'; import Menu from './Menu'; @@ -26,19 +27,35 @@ export default function LanguageButton({ menuPosition = 'bottom', menuAlign = 'l }); return ( -
- - {showMenu && ( - - )} -
+ <> + + {locale === 'zh-CN' && ( + + )} + {locale === 'jp-JP' && ( + + )} + +
+ + {showMenu && ( + + )} +
+ ); } diff --git a/components/layout/Layout.js b/components/layout/Layout.js index c961ade9..021745cc 100644 --- a/components/layout/Layout.js +++ b/components/layout/Layout.js @@ -13,10 +13,6 @@ export default function Layout({ title, children, header = true, footer = true } href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet" /> - {header &&
}
{children}