fix(spa): fallback font-serif to Prompt for Thai characters
This commit is contained in:
1 parent
eac45dd4a7
commit
e77ac4befa
4 files changed
+51
-2
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
||||
import ScrollToTop from './components/ScrollToTop'
|
||||
import { initLiff } from './lib/liff'
|
||||
@@ -23,6 +24,8 @@ import ProfilePage from './pages/ProfilePage'
|
||||
import CartDrawer from './components/CartDrawer'
|
||||
|
||||
function App() {
|
||||
const { i18n } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
const liffId = import.meta.env.VITE_LIFF_ID;
|
||||
if (liffId) {
|
||||
@@ -32,6 +35,19 @@ function App() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const lang = i18n.language;
|
||||
document.body.classList.remove('font-sans-ja', 'font-sans-zh', 'font-sans-ko');
|
||||
|
||||
if (lang === 'ja') {
|
||||
document.body.classList.add('font-sans-ja');
|
||||
} else if (lang === 'zh') {
|
||||
document.body.classList.add('font-sans-zh');
|
||||
} else if (lang === 'ko') {
|
||||
document.body.classList.add('font-sans-ko');
|
||||
}
|
||||
}, [i18n.language]);
|
||||
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<ScrollToTop />
|
||||
|
||||
Reference in new issue
Block a user