Skip to content

Commit

Permalink
fix(Header): hide i18n switch during the test (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocorallo committed Apr 28, 2023
1 parent 8212f9e commit 19ab791
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/components/Header.tsx
@@ -1,4 +1,4 @@
import { useContext, useState } from 'react'
import { useContext, useMemo, useState } from 'react'
import { StyleSheet } from '../utils/style'
import { statePair } from '../utils/types'
import logo from '../static/logo3000.webp'
Expand Down Expand Up @@ -51,14 +51,19 @@ export default function Header({ viewState }: HeaderProps) {
setLang(lang)
}

const isTestView = useMemo(
() => viewState[0] === 'TOL-testing' || viewState[0] === 'TOL-secRecap',
[viewState[0]]
)

return (
<div className="do-not-print" style={styles.div}>
<div style={styles.col}>
<a
style={{
...styles.logoDiv,
// disable logo link when doing the test
pointerEvents: viewState[0].startsWith('TOL') ? 'none' : 'all'
pointerEvents: isTestView ? 'none' : 'all'
}}
rel="noreferrer noopener"
target="_blank"
Expand All @@ -74,10 +79,12 @@ export default function Header({ viewState }: HeaderProps) {
</div>

<div style={{ ...styles.col, justifyContent: 'flex-end' }}>
<select value={lang} onChange={handleLanguageChange}>
<option value="it">IT</option>
<option value="en">EN</option>
</select>
{!isTestView && (
<select value={lang} onChange={handleLanguageChange}>
<option value="it">IT</option>
<option value="en">EN</option>
</select>
)}
</div>
</div>
)
Expand Down

0 comments on commit 19ab791

Please sign in to comment.