From 8290c82dd3b3bc61bfd069b1191f69f2b68f0b03 Mon Sep 17 00:00:00 2001 From: Hana Xu Date: Thu, 14 Nov 2024 12:11:21 -0500 Subject: [PATCH] desktop styling --- .../src/components/PrimaryNav/PrimaryLink.tsx | 1 - .../TopMenu/AddNewMenu/AddNewMenu.tsx | 176 +++++++++++------- 2 files changed, 108 insertions(+), 69 deletions(-) diff --git a/packages/manager/src/components/PrimaryNav/PrimaryLink.tsx b/packages/manager/src/components/PrimaryNav/PrimaryLink.tsx index 82111d89952..1e7ec07d1c0 100644 --- a/packages/manager/src/components/PrimaryNav/PrimaryLink.tsx +++ b/packages/manager/src/components/PrimaryNav/PrimaryLink.tsx @@ -23,7 +23,6 @@ export interface PrimaryLink extends BaseNavLink { interface PrimaryLinkProps extends PrimaryLink { closeMenu: () => void; isActiveLink: boolean; - isBeta?: boolean; isCollapsed: boolean; } diff --git a/packages/manager/src/features/TopMenu/AddNewMenu/AddNewMenu.tsx b/packages/manager/src/features/TopMenu/AddNewMenu/AddNewMenu.tsx index c5617f16282..35b60c81daa 100644 --- a/packages/manager/src/features/TopMenu/AddNewMenu/AddNewMenu.tsx +++ b/packages/manager/src/features/TopMenu/AddNewMenu/AddNewMenu.tsx @@ -1,13 +1,7 @@ +import { Box, Divider, omittedProps } from '@linode/ui'; import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown'; import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp'; -import { - Box, - Menu, - MenuItem, - Stack, - Typography, - useTheme, -} from '@mui/material'; +import { Menu, MenuItem, Stack, Typography, useTheme } from '@mui/material'; import { styled } from '@mui/material/styles'; import * as React from 'react'; import { Link } from 'react-router-dom'; @@ -59,7 +53,7 @@ export const AddNewMenu = () => { setAnchorEl(null); }; - const productFamilyLinkGroups: ProductFamilyLinkGroup[] = [ + const productFamilyLinkGroup: ProductFamilyLinkGroup[] = [ { icon: , links: [ @@ -93,22 +87,6 @@ export const AddNewMenu = () => { ], name: 'Compute', }, - { - icon: , - links: [ - { - description: 'S3-compatible object storage', - display: 'Bucket', - href: '/object-storage/buckets/create', - }, - { - description: 'Attach additional storage to your Linode', - display: 'Volume', - href: '/volumes/create', - }, - ], - name: 'Storage', - }, { icon: , links: [ @@ -135,6 +113,22 @@ export const AddNewMenu = () => { ], name: 'Networking', }, + { + icon: , + links: [ + { + description: 'S3-compatible object storage', + display: 'Bucket', + href: '/object-storage/buckets/create', + }, + { + description: 'Attach additional storage to your Linode', + display: 'Volume', + href: '/volumes/create', + }, + ], + name: 'Storage', + }, { icon: , links: [ @@ -149,6 +143,46 @@ export const AddNewMenu = () => { }, ]; + const ProductFamilyGroup = ( + productFamily: ProductFamilyLinkGroup + ) => { + return ( + <> + + {productFamily.icon} + {productFamily.name} + + {productFamily.links.map( + (link) => + !link.hide && [ + + + + {link.display} + + {link.description} + + , + ] + )} + + ); + }; + return ( { paper: { // UX requested a drop shadow that didn't affect the button. // If we revise our theme's shadows, we could consider removing - sx: { boxShadow: '0 2px 3px 3px rgba(0, 0, 0, 0.1)' }, + sx: { + boxShadow: '0 2px 3px 3px rgba(0, 0, 0, 0.1)', + [theme.breakpoints.up('md')]: { + maxWidth: '100%', + paddingBottom: 1, + paddingTop: 2, + }, + }, }, }} sx={{ @@ -191,46 +232,21 @@ export const AddNewMenu = () => { onClose={handleClose} open={open} > - {productFamilyLinkGroups.map((productFamily) => ( - <> - - {productFamily.icon} - {productFamily.name} - - {productFamily.links.map( - (link) => - !link.hide && [ - - - - {link.display} - - {link.description} - - , - ] - )} - - ))} + + {productFamilyLinkGroup.slice(0, 2).map((productFamily) => ( + <> + + {ProductFamilyGroup(productFamily)} + + + + ))} + + {productFamilyLinkGroup + .slice(2) + .map((productFamily) => ProductFamilyGroup(productFamily))} + + ); @@ -238,7 +254,8 @@ export const AddNewMenu = () => { export const StyledHeading = styled('h3', { label: 'StyledHeading', -})(({ theme }) => ({ + shouldForwardProp: omittedProps(['paddingTop']), +})<{ paddingTop?: boolean }>(({ theme, ...props }) => ({ '& svg': { height: 16, marginRight: theme.spacing(1), @@ -250,6 +267,29 @@ export const StyledHeading = styled('h3', { fontSize: '0.75rem', letterSpacing: '0.25px', margin: 0, - padding: '8px 10px', + padding: '8px 12px', textTransform: 'uppercase', + [theme.breakpoints.up('lg')]: { + background: 'inherit', + padding: `${props.paddingTop ? '16px' : '0px'} 16px 8px 16px`, + }, +})); + +export const StyledMenuItem = styled(MenuItem, { + label: 'StyledMenuItem', +})(({ theme }) => ({ + padding: '8px 14px', + // We have to do this because in packages/manager/src/index.css we force underline links + textDecoration: 'none !important', + [theme.breakpoints.up('md')]: { + padding: '8px 16px', + }, +})); + +export const StyledBox = styled(Box, { + label: 'StyledBox', +})(({ theme }) => ({ + [theme.breakpoints.up('md')]: { + display: 'flex', + }, }));