forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
56 lines (50 loc) · 1.55 KB
/
index.js
File metadata and controls
56 lines (50 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import * as React from 'react';
import type { Sandbox } from '@codesandbox/common/lib/types';
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
import Section from './Section';
import { SandboxInfo } from './SandboxInfo';
import FileTree from './FileTree';
import Dependencies from './Dependencies';
import ExternalResources from './ExternalResources';
import { Container, Button } from './elements';
type Props = {
sandbox: Sandbox,
setCurrentModule: (id: string) => void,
currentModule: string,
};
function Sidebar({ sandbox, setCurrentModule, currentModule }: Props) {
return (
<Container>
<Section title="CodeSandbox" openByDefault>
<SandboxInfo sandbox={sandbox} />
</Section>
<Section title="Files" openByDefault>
<FileTree
sandbox={sandbox}
currentModuleId={currentModule}
setCurrentModuleId={setCurrentModule}
/>
</Section>
<Section title="Dependencies">
<Dependencies sandbox={sandbox} />
</Section>
<Section
title="External Resources"
hidden={sandbox.externalResources.length === 0}
>
<ExternalResources sandbox={sandbox} />
</Section>
<Margin horizontal={0.5} vertical={1}>
<Button
href={sandboxUrl(sandbox) + '?from-embed'}
target="_blank"
rel="noreferrer noopener"
>
Edit Sandbox
</Button>
</Margin>
</Container>
);
}
export default Sidebar;