Skip to content

Commit 2d069ad

Browse files
authored
PLU-311: [GSIB-2] reduce font size on gsib browser (#780)
## Problem Plumber looks zoomed in on GSIB ## Solution By using the method in the previous PR. We simulate a zoom out by setting the font-size to a smaller value than 16 (i.e. 14). This works seemingly well since we use `rem` as much as possible.
1 parent a65c94a commit 2d069ad

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/frontend/src/components/ThemeProvider/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from '@mui/material/styles'
77
import { ThemeProvider as ChakraThemeProvider } from '@opengovsg/design-system-react'
88

9+
import { useDefaultZoom } from '@/hooks/useGovtBrowser'
910
import materialTheme from '@/styles/theme'
1011

1112
import { theme as chakraTheme } from '../../theme'
@@ -19,6 +20,7 @@ const ThemeProvider = ({
1920
}: ThemeProviderProps): React.ReactElement => {
2021
// This is a workaround to fix the issue of toasts appearing behind modal overlays
2122
const ref = useRef<HTMLDivElement>(null)
23+
useDefaultZoom()
2224
return (
2325
<ChakraThemeProvider
2426
theme={chakraTheme}

packages/frontend/src/hooks/useGovtBrowser.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* We check for existence of "menlo-view.menlosecurity.com" in window.name to determine if we should prepend the proxy url
77
*/
88

9-
import { useCallback } from 'react'
9+
import { useCallback, useEffect } from 'react'
1010

1111
const isGovtBrowser = window.name?.includes('menlo-view.menlosecurity.com')
1212

@@ -21,4 +21,14 @@ const useProxyUrl = () => {
2121
return { createProxiedUrl }
2222
}
2323

24-
export { useProxyUrl }
24+
const useDefaultZoom = () => {
25+
useEffect(() => {
26+
if (!isGovtBrowser) {
27+
return
28+
}
29+
// Set html font size to 14px
30+
document.documentElement.style.fontSize = '14px'
31+
}, [])
32+
}
33+
34+
export { useDefaultZoom, useProxyUrl }

0 commit comments

Comments
 (0)