Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: admin menu: unleash logo in header - links to dashboard #9676

Merged
merged 1 commit into from
Apr 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 50 additions & 6 deletions frontend/src/component/menu/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react';
import useMediaQuery from '@mui/material/useMediaQuery';
import { useTheme } from '@mui/material/styles';
import { type Theme, useTheme } from '@mui/material/styles';
import { Link } from 'react-router-dom';
import {
AppBar,
@@ -16,7 +16,6 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import MenuBookIcon from '@mui/icons-material/MenuBook';
import { ReactComponent as UnleashLogo } from 'assets/img/logoDarkWithText.svg';
import { ReactComponent as UnleashLogoWhite } from 'assets/img/logoWithWhiteText.svg';
import { ReactComponent as CelebatoryUnleashLogo } from 'assets/img/unleashHoliday.svg';

import { DrawerMenu } from './DrawerMenu/DrawerMenu';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
@@ -28,6 +27,10 @@ import { Notifications } from 'component/common/Notifications/Notifications';
import InviteLinkButton from './InviteLink/InviteLinkButton/InviteLinkButton';
import { useUiFlag } from 'hooks/useUiFlag';
import { CommandBar } from 'component/commandBar/CommandBar';
import { ThemeMode } from 'component/common/ThemeMode/ThemeMode';
import { ReactComponent as CelebratoryUnleashLogo } from 'assets/img/unleashHoliday.svg';
import { ReactComponent as CelebratoryUnleashLogoWhite } from 'assets/img/unleashHolidayDark.svg';
import { useNewAdminMenu } from 'hooks/useNewAdminMenu';

const HeaderComponent = styled(AppBar)(({ theme }) => ({
backgroundColor: theme.palette.background.application,
@@ -68,11 +71,13 @@ const StyledNav = styled('nav')({
flexGrow: 1,
});

const StyledUnleashLogoWhite = styled(UnleashLogoWhite)({ width: '150px' });
const StyledCelebratoryLogo = styled(CelebratoryUnleashLogo)({
height: '50px',
});

const StyledUnleashLogo = styled(UnleashLogo)({ width: '150px' });
const StyledUnleashLogoWhite = styled(UnleashLogoWhite)({ height: '50px' });

const StyledCelebatoryLogo = styled(CelebatoryUnleashLogo)({ width: '150px' });
const StyledUnleashLogo = styled(UnleashLogo)({ height: '50px' });

const StyledLink = styled(Link)(({ theme }) => focusable(theme));

@@ -99,7 +104,12 @@ const Header = () => {
const smallScreen = useMediaQuery(theme.breakpoints.down('lg'));
const [openDrawer, setOpenDrawer] = useState(false);
const toggleDrawer = () => setOpenDrawer((prev) => !prev);
const celebatoryUnleash = useUiFlag('celebrateUnleash');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you fixed the typo :)

const celebratoryUnleash = useUiFlag('celebrateUnleash');
const headerLogo = (theme: Theme) => ({
height: '50px',
marginLeft: theme.spacing(1.5),
});
const adminMenu = useNewAdminMenu();

if (smallScreen) {
return (
@@ -131,6 +141,40 @@ const Header = () => {
<HeaderComponent position='static'>
<ContainerComponent>
<StyledNav>
<ConditionallyRender
condition={adminMenu}
show={
<StyledLink
to='/personal'
sx={headerLogo}
aria-label='Home'
>
<ThemeMode
darkmode={
<ConditionallyRender
condition={celebratoryUnleash}
show={
<CelebratoryUnleashLogoWhite />
}
elseShow={
<StyledUnleashLogoWhite aria-label='Unleash logo' />
}
/>
}
lightmode={
<ConditionallyRender
condition={celebratoryUnleash}
show={<StyledCelebratoryLogo />}
elseShow={
<StyledUnleashLogo aria-label='Unleash logo' />
}
/>
}
/>
</StyledLink>
}
/>

<StyledUserContainer>
<CommandBar />
<Divider