Skip to content

Commit 8290c82

Browse files
committed
desktop styling
1 parent f049759 commit 8290c82

File tree

2 files changed

+108
-69
lines changed

2 files changed

+108
-69
lines changed

packages/manager/src/components/PrimaryNav/PrimaryLink.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export interface PrimaryLink extends BaseNavLink {
2323
interface PrimaryLinkProps extends PrimaryLink {
2424
closeMenu: () => void;
2525
isActiveLink: boolean;
26-
isBeta?: boolean;
2726
isCollapsed: boolean;
2827
}
2928

packages/manager/src/features/TopMenu/AddNewMenu/AddNewMenu.tsx

Lines changed: 108 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1+
import { Box, Divider, omittedProps } from '@linode/ui';
12
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
23
import KeyboardArrowUp from '@mui/icons-material/KeyboardArrowUp';
3-
import {
4-
Box,
5-
Menu,
6-
MenuItem,
7-
Stack,
8-
Typography,
9-
useTheme,
10-
} from '@mui/material';
4+
import { Menu, MenuItem, Stack, Typography, useTheme } from '@mui/material';
115
import { styled } from '@mui/material/styles';
126
import * as React from 'react';
137
import { Link } from 'react-router-dom';
@@ -59,7 +53,7 @@ export const AddNewMenu = () => {
5953
setAnchorEl(null);
6054
};
6155

62-
const productFamilyLinkGroups: ProductFamilyLinkGroup<MenuLink[]>[] = [
56+
const productFamilyLinkGroup: ProductFamilyLinkGroup<MenuLink[]>[] = [
6357
{
6458
icon: <LinodeIcon />,
6559
links: [
@@ -93,22 +87,6 @@ export const AddNewMenu = () => {
9387
],
9488
name: 'Compute',
9589
},
96-
{
97-
icon: <BucketIcon />,
98-
links: [
99-
{
100-
description: 'S3-compatible object storage',
101-
display: 'Bucket',
102-
href: '/object-storage/buckets/create',
103-
},
104-
{
105-
description: 'Attach additional storage to your Linode',
106-
display: 'Volume',
107-
href: '/volumes/create',
108-
},
109-
],
110-
name: 'Storage',
111-
},
11290
{
11391
icon: <NodebalancerIcon />,
11492
links: [
@@ -135,6 +113,22 @@ export const AddNewMenu = () => {
135113
],
136114
name: 'Networking',
137115
},
116+
{
117+
icon: <BucketIcon />,
118+
links: [
119+
{
120+
description: 'S3-compatible object storage',
121+
display: 'Bucket',
122+
href: '/object-storage/buckets/create',
123+
},
124+
{
125+
description: 'Attach additional storage to your Linode',
126+
display: 'Volume',
127+
href: '/volumes/create',
128+
},
129+
],
130+
name: 'Storage',
131+
},
138132
{
139133
icon: <DatabaseIcon />,
140134
links: [
@@ -149,6 +143,46 @@ export const AddNewMenu = () => {
149143
},
150144
];
151145

146+
const ProductFamilyGroup = (
147+
productFamily: ProductFamilyLinkGroup<MenuLink[]>
148+
) => {
149+
return (
150+
<>
151+
<StyledHeading paddingTop={productFamily.name === 'Databases'}>
152+
{productFamily.icon}
153+
{productFamily.name}
154+
</StyledHeading>
155+
{productFamily.links.map(
156+
(link) =>
157+
!link.hide && [
158+
<StyledMenuItem
159+
component={Link}
160+
key={link.display}
161+
onClick={handleClose}
162+
tabIndex={0}
163+
to={link.href}
164+
{...link.attr}
165+
>
166+
<Stack>
167+
<Typography
168+
sx={{
169+
color: theme.color.offBlack,
170+
fontFamily: theme.font.bold,
171+
fontSize: '1rem',
172+
lineHeight: '1.4rem',
173+
}}
174+
>
175+
{link.display}
176+
</Typography>
177+
<Typography>{link.description}</Typography>
178+
</Stack>
179+
</StyledMenuItem>,
180+
]
181+
)}
182+
</>
183+
);
184+
};
185+
152186
return (
153187
<Box
154188
sx={{
@@ -177,7 +211,14 @@ export const AddNewMenu = () => {
177211
paper: {
178212
// UX requested a drop shadow that didn't affect the button.
179213
// If we revise our theme's shadows, we could consider removing
180-
sx: { boxShadow: '0 2px 3px 3px rgba(0, 0, 0, 0.1)' },
214+
sx: {
215+
boxShadow: '0 2px 3px 3px rgba(0, 0, 0, 0.1)',
216+
[theme.breakpoints.up('md')]: {
217+
maxWidth: '100%',
218+
paddingBottom: 1,
219+
paddingTop: 2,
220+
},
221+
},
181222
},
182223
}}
183224
sx={{
@@ -191,54 +232,30 @@ export const AddNewMenu = () => {
191232
onClose={handleClose}
192233
open={open}
193234
>
194-
{productFamilyLinkGroups.map((productFamily) => (
195-
<>
196-
<StyledHeading>
197-
{productFamily.icon}
198-
{productFamily.name}
199-
</StyledHeading>
200-
{productFamily.links.map(
201-
(link) =>
202-
!link.hide && [
203-
<MenuItem
204-
component={Link}
205-
key={link.display}
206-
onClick={handleClose}
207-
to={link.href}
208-
{...link.attr}
209-
style={{
210-
padding: '8px 12px',
211-
// We have to do this because in packages/manager/src/index.css we force underline links
212-
textDecoration: 'none',
213-
}}
214-
tabIndex={0}
215-
>
216-
<Stack>
217-
<Typography
218-
sx={{
219-
color: theme.color.offBlack,
220-
fontFamily: theme.font.bold,
221-
fontSize: '1rem',
222-
lineHeight: '1.4rem',
223-
}}
224-
>
225-
{link.display}
226-
</Typography>
227-
<Typography>{link.description}</Typography>
228-
</Stack>
229-
</MenuItem>,
230-
]
231-
)}
232-
</>
233-
))}
235+
<Stack direction="row" tabIndex={-1}>
236+
{productFamilyLinkGroup.slice(0, 2).map((productFamily) => (
237+
<>
238+
<Stack key={productFamily.name} tabIndex={-1}>
239+
{ProductFamilyGroup(productFamily)}
240+
</Stack>
241+
<Divider orientation="vertical" sx={{ height: 'auto' }} />
242+
</>
243+
))}
244+
<Stack tabIndex={-1}>
245+
{productFamilyLinkGroup
246+
.slice(2)
247+
.map((productFamily) => ProductFamilyGroup(productFamily))}
248+
</Stack>
249+
</Stack>
234250
</Menu>
235251
</Box>
236252
);
237253
};
238254

239255
export const StyledHeading = styled('h3', {
240256
label: 'StyledHeading',
241-
})(({ theme }) => ({
257+
shouldForwardProp: omittedProps(['paddingTop']),
258+
})<{ paddingTop?: boolean }>(({ theme, ...props }) => ({
242259
'& svg': {
243260
height: 16,
244261
marginRight: theme.spacing(1),
@@ -250,6 +267,29 @@ export const StyledHeading = styled('h3', {
250267
fontSize: '0.75rem',
251268
letterSpacing: '0.25px',
252269
margin: 0,
253-
padding: '8px 10px',
270+
padding: '8px 12px',
254271
textTransform: 'uppercase',
272+
[theme.breakpoints.up('lg')]: {
273+
background: 'inherit',
274+
padding: `${props.paddingTop ? '16px' : '0px'} 16px 8px 16px`,
275+
},
276+
}));
277+
278+
export const StyledMenuItem = styled(MenuItem, {
279+
label: 'StyledMenuItem',
280+
})(({ theme }) => ({
281+
padding: '8px 14px',
282+
// We have to do this because in packages/manager/src/index.css we force underline links
283+
textDecoration: 'none !important',
284+
[theme.breakpoints.up('md')]: {
285+
padding: '8px 16px',
286+
},
287+
}));
288+
289+
export const StyledBox = styled(Box, {
290+
label: 'StyledBox',
291+
})(({ theme }) => ({
292+
[theme.breakpoints.up('md')]: {
293+
display: 'flex',
294+
},
255295
}));

0 commit comments

Comments
 (0)