Fix function to determine mobile viewport for SSR
This commit is contained in:
@@ -35,6 +35,9 @@ const messages = {
|
||||
export const translate = (key) => (messages[key] || '-');
|
||||
|
||||
export function isMobileViewport() {
|
||||
// return false for server side rendering
|
||||
if (typeof window == 'undefined') return false;
|
||||
|
||||
const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
||||
return width < 1200;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user