Skip to content

Commit f4a3997

Browse files
authored
menu design + fix grid (codesandbox#4010)
1 parent c2d2ea6 commit f4a3997

File tree

5 files changed

+79
-21
lines changed

5 files changed

+79
-21
lines changed

packages/app/src/app/pages/NewDashboard/Components/SandboxCard/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ export const SandboxCard = ({ sandbox, template, ...props }: Props) => {
4747
>
4848
<Element
4949
as="div"
50-
css={{
50+
css={css({
5151
height: 160,
52+
backgroundColor: 'grays.600',
5253
backgroundImage: `url(${sandbox.screenshotUrl})`,
5354
backgroundSize: 'cover',
5455
backgroundPosition: 'center center',
5556
backgroundRepeat: 'no-repeat',
56-
}}
57+
})}
5758
/>
5859
<Stack justify="space-between" align="center" marginLeft={4}>
5960
{edit ? (

packages/app/src/app/pages/NewDashboard/Content/routes/StartSandboxes/index.tsx

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import React, { useEffect } from 'react';
2+
import { Link as RouterLink } from 'react-router-dom';
23
import { useOvermind } from 'app/overmind';
3-
import { Text, Button, Grid, Column } from '@codesandbox/components';
4+
import {
5+
Stack,
6+
Grid,
7+
Column,
8+
Text,
9+
Link,
10+
Button,
11+
} from '@codesandbox/components';
412
import css from '@styled-system/css';
513
import { SandboxCard } from 'app/pages/NewDashboard/Components/SandboxCard';
614
import { Loading } from 'app/pages/NewDashboard/Components/Loading';
@@ -21,16 +29,17 @@ export const StartSandboxes = () => {
2129
return (
2230
<>
2331
<section style={{ position: 'relative' }}>
24-
<Text marginBottom={4} block>
25-
Recently used Templates
26-
</Text>
32+
<Stack justify="space-between" marginBottom={4}>
33+
<Text>Recently Used Templates</Text>
34+
</Stack>
35+
2736
{sandboxes.TEMPLATE_START_PAGE ? (
2837
<Grid
2938
rowGap={6}
3039
columnGap={6}
3140
marginBottom={8}
3241
css={css({
33-
gridTemplateColumns: 'repeat(auto-fit,minmax(220px,0.2fr))',
42+
gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))',
3443
})}
3544
>
3645
{sandboxes.TEMPLATE_START_PAGE.map(({ sandbox }) => (
@@ -45,20 +54,20 @@ export const StartSandboxes = () => {
4554
</section>
4655

4756
<section style={{ position: 'relative' }}>
48-
<Text
49-
marginBottom={4}
50-
block
51-
css={css({ position: 'relative', zIndex: 99 })}
52-
>
53-
Your Recent Sandboxes
54-
</Text>
57+
<Stack justify="space-between" align="center" marginBottom={4}>
58+
<Text>Your Recent Sandboxes</Text>
59+
<Link as={RouterLink} to="recent" size={3} variant="muted">
60+
Show more
61+
</Link>
62+
</Stack>
63+
5564
{sandboxes.RECENT_START_PAGE ? (
5665
<Grid
5766
rowGap={6}
5867
columnGap={6}
5968
marginBottom={8}
6069
css={css({
61-
gridTemplateColumns: 'repeat(auto-fit,minmax(220px,0.2fr))',
70+
gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))',
6271
})}
6372
>
6473
<Column>

packages/app/src/app/pages/NewDashboard/Sidebar/index.tsx

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ export const Sidebar = props => {
7878
width: '100%',
7979
height: '100%',
8080
paddingLeft: 2,
81+
borderBottom: '1px solid',
82+
borderColor: 'sideBar.border',
83+
borderRadius: 0,
8184
})}
8285
>
8386
<Stack as="span" align="center">
@@ -95,12 +98,31 @@ export const Sidebar = props => {
9598
</Stack>
9699
<Icon name="caret" size={8} />
97100
</Stack>
98-
<Menu.List css={{ width: SIDEBAR_WIDTH }}>
101+
<Menu.List style={{ width: SIDEBAR_WIDTH, borderRadius: 0 }}>
99102
<Menu.Item
100103
css={{ textAlign: 'left' }}
101104
onSelect={() => actions.dashboard.setActiveTeam({ id: null })}
102105
>
103-
<Text size={3}>{user.username} (Personal)</Text>
106+
<Stack align="center">
107+
<Stack
108+
as="span"
109+
css={css({ width: 8 })}
110+
align="center"
111+
justify="center"
112+
>
113+
<Avatar user={user} css={css({ size: 5 })} />
114+
</Stack>
115+
<Text
116+
size={3}
117+
weight={
118+
activeAccount.username === user.username
119+
? 'semibold'
120+
: 'normal'
121+
}
122+
>
123+
{user.username} (Personal)
124+
</Text>
125+
</Stack>
104126
</Menu.Item>
105127
{dashboard.teams.map(team => (
106128
<Menu.Item
@@ -111,7 +133,32 @@ export const Sidebar = props => {
111133
actions.dashboard.setActiveTeam({ id: team.id })
112134
}
113135
>
114-
<Text size={3}>{team.name}</Text>
136+
<Stack align="center">
137+
<Stack
138+
as="span"
139+
css={css({ width: 8 })}
140+
align="center"
141+
justify="center"
142+
>
143+
<Avatar
144+
user={{
145+
username: team.name,
146+
avatarUrl: 'https://github.com/github.png',
147+
}}
148+
css={css({ size: 5 })}
149+
/>
150+
</Stack>
151+
<Text
152+
size={3}
153+
weight={
154+
activeAccount.username === team.name
155+
? 'semibold'
156+
: 'normal'
157+
}
158+
>
159+
{team.name}
160+
</Text>
161+
</Stack>
115162
</Menu.Item>
116163
))}
117164
</Menu.List>

packages/components/src/components/Menu/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ const PortalStyles = createGlobalStyle(
5454
'&[data-selected]': {
5555
outline: 'none',
5656
backgroundColor: 'menuList.hoverBackground',
57-
color: 'menuList.foreground',
57+
color: 'menuList.hoverForeground',
5858
},
5959
// override reach ui styles
60-
font: 'ineherit',
60+
font: 'inherit',
6161
},
6262
}),
6363
styledcss`

packages/components/src/utils/polyfill-theme.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,10 @@ const polyfillTheme = vsCodeTheme => {
201201
},
202202
menuList: {
203203
background: uiColors.sideBar.background,
204+
foreground: uiColors.mutedForeground,
204205
border: uiColors.sideBar.border,
205206
hoverBackground: uiColors.sideBar.border,
206-
foreground: uiColors.sideBar.foreground,
207+
hoverForeground: uiColors.sideBar.foreground,
207208
},
208209
};
209210

0 commit comments

Comments
 (0)