Skip to content

Commit 2ec8a5e

Browse files
authored
add header (#3954)
1 parent 2a832de commit 2ec8a5e

File tree

3 files changed

+116
-15
lines changed

3 files changed

+116
-15
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import React from 'react';
2+
import { useOvermind } from 'app/overmind';
3+
import { UserMenu } from 'app/pages/common/UserMenu';
4+
import {
5+
Stack,
6+
Input,
7+
Button,
8+
Icon,
9+
IconButton,
10+
} from '@codesandbox/components';
11+
import css from '@styled-system/css';
12+
13+
export const Header = () => {
14+
const {
15+
actions: { modalOpened },
16+
} = useOvermind();
17+
18+
return (
19+
<Stack
20+
as="header"
21+
justify="space-between"
22+
align="center"
23+
paddingX={4}
24+
css={css({
25+
boxSizing: 'border-box',
26+
fontFamily: 'Inter, sans-serif',
27+
height: 12,
28+
backgroundColor: 'titleBar.activeBackground',
29+
color: 'titleBar.activeForeground',
30+
borderBottom: '1px solid',
31+
borderColor: 'titleBar.border',
32+
})}
33+
>
34+
<IconButton name="menu" size={18} title="Menu" />
35+
<Input
36+
type="text"
37+
placeholder="Search all sandboxes"
38+
css={{ maxWidth: 480 }}
39+
/>
40+
<Stack align="center" gap={2}>
41+
<Button
42+
variant="primary"
43+
css={css({ width: 'auto', paddingX: 3 })}
44+
onClick={() => modalOpened({ modal: 'newSandbox' })}
45+
>
46+
Create Sandbox
47+
</Button>
48+
<Button variant="secondary" css={css({ size: 26 })}>
49+
<Icon name="bell" size={11} title="Notifications" />
50+
</Button>
51+
<UserMenu>
52+
<Button variant="secondary" css={css({ size: 26 })}>
53+
<Icon name="more" size={12} title="User actions" />
54+
</Button>
55+
</UserMenu>
56+
</Stack>
57+
</Stack>
58+
);
59+
};

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

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { signInPageUrl } from '@codesandbox/common/lib/utils/url-generator';
2-
import css from '@styled-system/css';
32
import React, { useEffect, FunctionComponent } from 'react';
43
import { Redirect } from 'react-router-dom';
54
import { client } from 'app/graphql/client';
65
import { useOvermind } from 'app/overmind';
76
import codesandboxBlack from '@codesandbox/components/lib/themes/codesandbox-black';
87
import { ThemeProvider, Stack } from '@codesandbox/components';
8+
import css from '@styled-system/css';
9+
10+
import { Header } from './Header';
911
import { Sidebar } from './Sidebar';
1012
import { Content } from './Content';
1113

@@ -30,18 +32,21 @@ export const Dashboard: FunctionComponent = () => {
3032

3133
return (
3234
<ThemeProvider theme={codesandboxBlack}>
33-
<Stack
34-
gap={6}
35-
css={css({
36-
backgroundColor: 'sideBar.background',
37-
fontFamily: "'Inter', sans-serif",
38-
color: 'sideBar.foreground',
39-
minHeight: '100vh',
40-
width: '100vw',
41-
})}
42-
>
43-
<Sidebar />
44-
<Content />
35+
<Stack direction="vertical">
36+
<Header />
37+
<Stack
38+
gap={6}
39+
css={css({
40+
backgroundColor: 'sideBar.background',
41+
fontFamily: "'Inter', sans-serif",
42+
color: 'sideBar.foreground',
43+
minHeight: 'calc(100vh - 48px)',
44+
width: '100vw',
45+
})}
46+
>
47+
<Sidebar />
48+
<Content />
49+
</Stack>
4550
</Stack>
4651
</ThemeProvider>
4752
);

packages/components/src/components/Icon/icons.tsx

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,17 @@ export const cross = props => (
202202
);
203203

204204
export const plus = props => (
205-
<svg width={16} height={16} fill="none" viewBox="0 0 16 16" {...props}>
205+
<Element
206+
as="svg"
207+
viewBox="0 0 16 16"
208+
xmlns="http://www.w3.org/2000/svg"
209+
{...props}
210+
>
206211
<path
207212
fill="currentColor"
208213
d="M8.6 2H7.4v5.4H2v1.2h5.4V14h1.2V8.6H14V7.4H8.6V2z"
209214
/>
210-
</svg>
215+
</Element>
211216
);
212217

213218
export const trash = props => (
@@ -220,3 +225,35 @@ export const trash = props => (
220225
/>
221226
</svg>
222227
);
228+
229+
export const menu = props => (
230+
<Element
231+
as="svg"
232+
viewBox="0 0 16 16"
233+
xmlns="http://www.w3.org/2000/svg"
234+
{...props}
235+
>
236+
<path
237+
d="M16 4H0V3H16V4ZM16 8.66762H0V7.66762H16V8.66762ZM0 13.3352H16V12.3352H0V13.3352Z"
238+
fill="currentColor"
239+
fillRule="evenodd"
240+
clipRule="evenodd"
241+
/>
242+
</Element>
243+
);
244+
245+
export const bell = props => (
246+
<Element
247+
as="svg"
248+
viewBox="0 0 16 16"
249+
xmlns="http://www.w3.org/2000/svg"
250+
{...props}
251+
>
252+
<path
253+
d="M9.03657 1.06667C9.03657 1.10232 9.03487 1.13756 9.03155 1.17231C11.3998 1.66446 13.1829 3.81795 13.1829 6.4V8.53333L15.3507 12.2512C15.7652 12.9622 15.2675 13.8667 14.4618 13.8667H8H1.53818C0.732452 13.8667 0.234778 12.9622 0.649321 12.2512L2.81711 8.53333L2.81711 6.4C2.81711 3.81795 4.60022 1.66446 6.96844 1.17231C6.96512 1.13756 6.96342 1.10232 6.96342 1.06667C6.96342 0.477563 7.42751 0 8 0C8.57248 0 9.03657 0.477563 9.03657 1.06667ZM8.00001 16C7.23265 16 6.56267 15.571 6.20421 14.9333H9.79581C9.43735 15.571 8.76737 16 8.00001 16Z"
254+
fill="currentColor"
255+
fillRule="evenodd"
256+
clipRule="evenodd"
257+
/>
258+
</Element>
259+
);

0 commit comments

Comments
 (0)