forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
36 lines (32 loc) · 1.03 KB
/
index.tsx
File metadata and controls
36 lines (32 loc) · 1.03 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
import { Sandbox } from '@codesandbox/common/lib/types';
import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name';
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
import React, { FunctionComponent } from 'react';
import AvatarBlock from '../AvatarBlock';
import { Container, Description, Stats, Title, Button } from './elements';
type Props = {
sandbox: Sandbox;
};
export const SandboxInfo: FunctionComponent<Props> = ({ sandbox }) => {
const title = getSandboxName(sandbox);
return (
<Container>
<Title title={title}>{title}</Title>
{sandbox.description && <Description>{sandbox.description}</Description>}
{sandbox.author && (
<AvatarBlock
url={sandbox.author.avatarUrl}
name={sandbox.author.username}
/>
)}
<Stats {...sandbox} />
<Button
href={sandboxUrl(sandbox) + '?from-embed'}
target="_blank"
rel="noreferrer noopener"
>
Edit Sandbox
</Button>
</Container>
);
};