Skip to content

Commit e49771d

Browse files
MichaelDeBoeyCompuIves
authored andcommitted
Get correct SandboxInfo title (codesandbox#2970)
1 parent 43f8f8e commit e49771d

File tree

4 files changed

+34
-26
lines changed

4 files changed

+34
-26
lines changed

packages/app/src/embed/components/Sidebar/SandboxInfo/elements.js renamed to packages/app/src/embed/components/Sidebar/SandboxInfo/elements.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import styled from 'styled-components';
2-
import css from '@styled-system/css';
31
import CommonStats from '@codesandbox/common/lib/components/Stats';
42
import { CenteredText } from '@codesandbox/common/lib/components/Stats/Stat/elements';
3+
import css from '@styled-system/css';
4+
import styled from 'styled-components';
55

66
export const Container = styled.div(
77
css({

packages/app/src/embed/components/Sidebar/SandboxInfo/index.js

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Sandbox } from '@codesandbox/common/lib/types';
2+
import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name';
3+
import React, { FunctionComponent } from 'react';
4+
5+
import AvatarBlock from '../AvatarBlock';
6+
7+
import { Container, Description, Stats, Title } from './elements';
8+
9+
type Props = {
10+
sandbox: Sandbox;
11+
};
12+
export const SandboxInfo: FunctionComponent<Props> = ({ sandbox }) => {
13+
const title = getSandboxName(sandbox);
14+
15+
return (
16+
<Container>
17+
<Title title={title}>{title}</Title>
18+
19+
{sandbox.description && <Description>{sandbox.description}</Description>}
20+
21+
{sandbox.author && (
22+
<AvatarBlock
23+
url={sandbox.author.avatarUrl}
24+
name={sandbox.author.username}
25+
/>
26+
)}
27+
28+
<Stats {...sandbox} />
29+
</Container>
30+
);
31+
};

packages/app/src/embed/components/Sidebar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import type { Sandbox } from '@codesandbox/common/lib/types';
33

44
import Section from './Section';
5-
import SandboxInfo from './SandboxInfo';
5+
import { SandboxInfo } from './SandboxInfo';
66
import FileTree from './FileTree';
77
import Dependencies from './Dependencies';
88
import ExternalResources from './ExternalResources';

0 commit comments

Comments
 (0)