Skip to content

Commit

Permalink
[Navigation bar] Turn the user button orange when mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
rikurauhala committed Nov 27, 2024
1 parent e328258 commit c88d598
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export const UserButton = () => {
const { isLoading, mockedBy, username } = useGetAuthorizedUserQuery()
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)

const currentLanguage: string = language as unknown as string // TODO: Fix the type in the origin

const languageOptions = LANGUAGE_CODES.map(code => ({
key: code,
text: LANGUAGE_TEXTS[code],
Expand All @@ -24,10 +22,12 @@ export const UserButton = () => {
return (
<Box sx={{ flexGrow: 0 }}>
<IconButton
color="inherit"
data-cy="nav-bar-user-button"
onClick={event => setAnchorEl(event.currentTarget)}
sx={{ p: 0 }}
sx={{
color: mockedBy ? theme => theme.palette.warning.light : 'inherit',
padding: 0,
}}
>
<AccountCircle />
</IconButton>
Expand Down Expand Up @@ -62,9 +62,9 @@ export const UserButton = () => {
<Typography>Language</Typography>
</MenuItem>
{languageOptions.map(({ key, text, value }) => (
<MenuItem key={key} onClick={() => setLanguage(value)} selected={currentLanguage === value}>
<ListItemIcon>{currentLanguage === value ? <Check fontSize="small" /> : null}</ListItemIcon>
<Typography fontWeight={currentLanguage === value ? 'bold' : 'normal'}>{text}</Typography>
<MenuItem key={key} onClick={() => setLanguage(value)} selected={language === value}>
<ListItemIcon>{language === value ? <Check fontSize="small" /> : null}</ListItemIcon>
<Typography fontWeight={language === value ? 'bold' : 'normal'}>{text}</Typography>
</MenuItem>
))}
<Divider />
Expand Down

0 comments on commit c88d598

Please sign in to comment.