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

change: [M3-9003] – CDS: Restructure Top Menu Design with Akamai Logo and CDS Compass Updates #11452

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
996731f
Initial changes: top menu spans full width of app, logo moved to top …
DevDW Dec 20, 2024
fda627c
Merge in latest feature branch, resolve conflicts, minor improvements
DevDW Jan 3, 2025
b234848
Update icon svg's; match mockups more closely and fix colors; impleme…
DevDW Jan 6, 2025
52f53e7
Merge branch 'cds-redesign-2025' into M3-9003-cds-restructure-top-menu
DevDW Jan 6, 2025
6d39156
Adjust import path
DevDW Jan 6, 2025
ebfef09
Update MuiButton padding, remove minWidth on buttons; use GlobalHeade…
DevDW Jan 7, 2025
3b1d0fc
Remove sx prop from CreateMenu button
DevDW Jan 7, 2025
0f403fe
Fix KeyboardArrowUp and KeyboardArrowDown color in UserMenu.tsx
DevDW Jan 8, 2025
c55154b
MaxWidth initial
jaalah Jan 8, 2025
167ed67
Merge in latest feature branch, resolve conflicts
DevDW Jan 8, 2025
18cde8c
Remove search bar border on hover
DevDW Jan 8, 2025
69d79a7
Stop container holding x button in search bar from spilling outside o…
DevDW Jan 9, 2025
fb09a70
Reduce zIndex of <Box /> wrapping <SideMenu /> to prevent the side me…
DevDW Jan 9, 2025
8ec6160
Mock preference in PrimaryNav.test.tsx so items are expanded by defau…
DevDW Jan 9, 2025
d3b872b
Saving...
jaalah Jan 11, 2025
9c2ba5e
Saving...
jaalah Jan 11, 2025
3c7b28c
Saving...
jaalah Jan 11, 2025
c38005c
Final cleanup of top menu
jaalah Jan 12, 2025
86a8390
Cleanup UserMenu
jaalah Jan 13, 2025
5bdf57d
Remove commented code
jaalah Jan 13, 2025
2545268
Merge branch 'cds-redesign-2025' into M3-9003-cds-restructure-top-menu
jaalah-akamai Jan 13, 2025
a7e0e9c
Fix TS errors
DevDW Jan 13, 2025
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
2 changes: 1 addition & 1 deletion packages/manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@emotion/styled": "^11.11.0",
"@hookform/resolvers": "3.9.1",
"@linode/api-v4": "*",
"@linode/design-language-system": "^2.9.0",
"@linode/design-language-system": "^2.11.1",
"@linode/search": "*",
"@linode/ui": "*",
"@linode/validation": "*",
Expand Down
34 changes: 25 additions & 9 deletions packages/manager/src/MainContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Box } from '@linode/ui';
import { useMediaQuery } from '@mui/material';
import Grid from '@mui/material/Unstable_Grid2';
import { useQueryClient } from '@tanstack/react-query';
import { RouterProvider } from '@tanstack/react-router';
Expand All @@ -9,7 +10,10 @@ import { makeStyles } from 'tss-react/mui';
import Logo from 'src/assets/logo/akamai-logo.svg';
import { MainContentBanner } from 'src/components/MainContentBanner';
import { MaintenanceScreen } from 'src/components/MaintenanceScreen';
import { SIDEBAR_WIDTH } from 'src/components/PrimaryNav/constants';
import {
SIDEBAR_COLLAPSED_WIDTH,
SIDEBAR_WIDTH,
} from 'src/components/PrimaryNav/constants';
import { SideMenu } from 'src/components/PrimaryNav/SideMenu';
import { SuspenseLoader } from 'src/components/SuspenseLoader';
import { useDialogContext } from 'src/context/useDialogContext';
Expand Down Expand Up @@ -81,16 +85,10 @@ const useStyles = makeStyles()((theme: Theme) => ({
},
content: {
flex: 1,
[theme.breakpoints.up('md')]: {
marginLeft: SIDEBAR_WIDTH,
},
transition: 'margin-left .1s linear',
},
fullWidthContent: {
marginLeft: 0,
[theme.breakpoints.up('md')]: {
marginLeft: 52,
},
},
grid: {
marginLeft: 0,
Expand Down Expand Up @@ -240,6 +238,10 @@ export const MainContent = () => {

const { isIAMEnabled } = useIsIAMEnabled();

const isNarrowViewport = useMediaQuery((theme: Theme) =>
theme.breakpoints.down(960)
);

/**
* this is the case where the user has successfully completed signup
* but needs a manual review from Customer Support. In this case,
Expand Down Expand Up @@ -299,8 +301,9 @@ export const MainContent = () => {
<SwitchAccountSessionProvider value={switchAccountSessionContextValue}>
<ComplianceUpdateProvider value={complianceUpdateContextValue}>
<NotificationProvider value={contextValue}>
<MainContentBanner />
<TopMenu
isSideMenuOpen={!desktopMenuIsOpen}
desktopMenuToggle={desktopMenuToggle}
openSideMenu={() => toggleMenu(true)}
username={username}
/>
Expand All @@ -310,7 +313,7 @@ export const MainContent = () => {
height="100vh"
position="sticky"
top={0}
zIndex={10000}
zIndex={1400}
>
<SideMenu
closeMenu={() => toggleMenu(false)}
Expand All @@ -327,6 +330,19 @@ export const MainContent = () => {
>
<MainContentBanner />
<main
/*
- Narrow viewports (<960px) never have a left margin
- If the user has unpinned the side menu, the left margin === the width of the collapsed side menu
- Otherwise, the left margin === the width of the fully expanded side menu
*/
style={{
marginLeft: isNarrowViewport
? 0
: desktopMenuIsOpen ||
(desktopMenuIsOpen && desktopMenuIsOpen === true)
? SIDEBAR_COLLAPSED_WIDTH
: SIDEBAR_WIDTH,
}}
className={classes.cmrWrapper}
id="main-content"
role="main"
Expand Down
22 changes: 9 additions & 13 deletions packages/manager/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,19 @@ export const Root = () => {
<SwitchAccountSessionProvider value={switchAccountSessionContextValue}>
<ComplianceUpdateProvider value={complianceUpdateContextValue}>
<NotificationProvider value={contextValue}>
<MainContentBanner />
<TopMenu
isSideMenuOpen={!desktopMenuIsOpen}
desktopMenuToggle={desktopMenuToggle}
openSideMenu={() => toggleMenu(true)}
username={username}
/>
<SideMenu
closeMenu={() => toggleMenu(false)}
collapse={desktopMenuIsOpen || false}
desktopMenuToggle={desktopMenuToggle}
open={menuIsOpen}
/>
<div
className={cx(classes.content, {
[classes.fullWidthContent]: desktopMenuIsOpen,
})}
>
<MainContentBanner />
<div className={classes.content}>
<SideMenu
closeMenu={() => toggleMenu(false)}
collapse={desktopMenuIsOpen || false}
desktopMenuToggle={desktopMenuToggle}
open={menuIsOpen}
/>
<main
className={classes.cmrWrapper}
id="main-content"
Expand Down
3 changes: 3 additions & 0 deletions packages/manager/src/assets/icons/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion packages/manager/src/assets/icons/community_nav.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion packages/manager/src/assets/icons/get_help.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/manager/src/assets/icons/keyboardarrowdown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/manager/src/assets/icons/keyboardarrowup.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion packages/manager/src/assets/icons/notification.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/manager/src/assets/icons/search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/manager/src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const Avatar = (props: AvatarProps) => {

const savedAvatarColor =
isAkamai || !avatarColorPreference
? theme.palette.primary.dark
? theme.tokens.color.Neutrals[30]
: avatarColorPreference;

const avatarLetter = _username[0]?.toUpperCase() ?? '';
Expand Down
24 changes: 0 additions & 24 deletions packages/manager/src/components/PrimaryNav/PrimaryNav.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,12 @@ export const StyledGrid = styled(Grid, {
width: '100%',
}));

export const StyledLogoBox = styled(Box, {
label: 'StyledLogoBox',
})(({ theme }) => ({
alignItems: 'center',
display: 'flex',
height: 50,
paddingBottom: 16,
paddingLeft: 12,
paddingRight: 24,
paddingTop: 16,
[theme.breakpoints.down('md')]: {
borderRight: `1px solid ${theme.tokens.border.Normal}`,
},
transition: 'padding-left .03s linear',
}));

export const StyledAkamaiLogo = styled(AkamaiLogo, {
label: 'StyledAkamaiLogo',
})(({ theme }) => ({
'& .akamai-logo-name': {
transition: theme.transitions.create(['opacity']),
},
'path, polygon': {
fill: theme.tokens.color.Neutrals.White,
[theme.breakpoints.down('md')]: {
fill: theme.tokens.sideNavigation.Icon,
},
},
// give the svg a transition so it smoothly resizes
transition: 'width .1s linear',
}));

export const StyledDivider = styled(Divider, {
Expand Down
31 changes: 31 additions & 0 deletions packages/manager/src/components/PrimaryNav/PrimaryNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { renderWithTheme, wrapWithTheme } from 'src/utilities/testHelpers';
import PrimaryNav from './PrimaryNav';

import type { Flags } from 'src/featureFlags';
import type { ManagerPreferences } from 'src/types/ManagerPreferences';

const props = {
closeMenu: vi.fn(),
Expand All @@ -21,6 +22,20 @@ const queryClient = queryClientFactory();
const queryString = 'menu-item-Managed';

describe('PrimaryNav', () => {
const preference: ManagerPreferences['collapsedSideNavProductFamilies'] = [];

const queryMocks = vi.hoisted(() => ({
usePreferences: vi.fn().mockReturnValue({}),
}));

vi.mock('src/queries/profile/preferences', async () => {
const actual = await vi.importActual('src/queries/profile/preferences');
return {
...actual,
usePreferences: queryMocks.usePreferences,
};
});

it('only contains a "Managed" menu link if the user has Managed services.', async () => {
server.use(
http.get('*/account/maintenance', () => {
Expand Down Expand Up @@ -58,6 +73,10 @@ describe('PrimaryNav', () => {
});

it('should show Databases menu item if the user has the account capability V1', async () => {
queryMocks.usePreferences.mockReturnValue({
data: preference,
});

const account = accountFactory.build({
capabilities: ['Managed Databases'],
});
Expand Down Expand Up @@ -89,6 +108,10 @@ describe('PrimaryNav', () => {
});

it('should show Databases menu item if the user has the account capability V2 Beta', async () => {
queryMocks.usePreferences.mockReturnValue({
data: preference,
});

const account = accountFactory.build({
capabilities: ['Managed Databases Beta'],
});
Expand Down Expand Up @@ -118,6 +141,10 @@ describe('PrimaryNav', () => {
});

it('should show Databases menu item if the user has the account capability V2', async () => {
queryMocks.usePreferences.mockReturnValue({
data: preference,
});

const account = accountFactory.build({
capabilities: ['Managed Databases'],
});
Expand Down Expand Up @@ -149,6 +176,10 @@ describe('PrimaryNav', () => {
});

it('should show Databases menu item if the user has the account capability V2', async () => {
queryMocks.usePreferences.mockReturnValue({
data: preference,
});

const account = accountFactory.build({
capabilities: ['Managed Databases Beta'],
});
Expand Down
Loading
Loading