Skip to content

Commit 2256508

Browse files
MichaelDeBoeyCompuIves
authored andcommitted
Fix SandboxInfo (#2967)
1 parent c05030a commit 2256508

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

packages/app/src/app/pages/Profile/Showcase/SandboxInfo/elements.js renamed to packages/app/src/app/pages/Profile/Showcase/SandboxInfo/elements.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import styled from 'styled-components';
21
import delayEffect from '@codesandbox/common/lib/utils/animation/delay-effect';
32
import { Link } from 'react-router-dom';
3+
import styled from 'styled-components';
4+
45
import { LikeHeart } from 'app/pages/common/LikeHeart';
56

67
export const Container = styled.div`
@@ -18,7 +19,6 @@ export const Container = styled.div`
1819
`;
1920

2021
export const Title = styled.h1`
21-
font-weight: 400;
2222
margin: 0;
2323
padding: 0;
2424
box-sizing: border-box;
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
import React from 'react';
1+
import Row from '@codesandbox/common/lib/components/flex/Row';
2+
import { Sandbox } from '@codesandbox/common/lib/types';
23
import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name';
34
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
4-
import Row from '@codesandbox/common/lib/components/flex/Row';
5+
import React, { FunctionComponent } from 'react';
6+
57
import { Stat } from 'app/components/Stat';
6-
import SvgButton from './play-button.svg';
8+
import { useOvermind } from 'app/overmind';
9+
710
import {
811
Container,
9-
Title,
10-
Like,
1112
Description,
12-
Stats,
13+
Like,
1314
PlayButtonContainer,
15+
Stats,
16+
Title,
1417
} from './elements';
18+
import SvgButton from './play-button.svg';
19+
20+
type Props = {
21+
sandbox: Sandbox;
22+
};
23+
export const SandboxInfo: FunctionComponent<Props> = ({ sandbox }) => {
24+
const {
25+
state: { isLoggedIn },
26+
} = useOvermind();
1527

16-
function SandboxInfo({ sandbox, isLoggedIn }) {
1728
return (
1829
<Container>
1930
<Row alignItems="center">
@@ -22,21 +33,24 @@ function SandboxInfo({ sandbox, isLoggedIn }) {
2233
{isLoggedIn ? <Like sandbox={sandbox} /> : null}
2334
</Title>
2435
</Row>
36+
2537
<Row alignItems="flex-start">
2638
<div style={{ flex: 6 }}>
2739
<Description>{sandbox.description}</Description>
2840
</div>
41+
2942
<Stats>
3043
<PlayButtonContainer to={sandboxUrl({ id: sandbox.id })}>
3144
<img alt="edit" src={SvgButton} />
3245
</PlayButtonContainer>
46+
3347
<Stat name="likes" count={sandbox.likeCount} />
48+
3449
<Stat name="views" count={sandbox.viewCount} />
50+
3551
<Stat name="forks" count={sandbox.forkCount} />
3652
</Stats>
3753
</Row>
3854
</Container>
3955
);
40-
}
41-
42-
export default SandboxInfo;
56+
};

packages/app/src/app/pages/Profile/Showcase/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
import React from 'react';
1+
import React, { FunctionComponent } from 'react';
22
import { useOvermind } from 'app/overmind';
33

44
import Column from '@codesandbox/common/lib/components/flex/Column';
55
import Centered from '@codesandbox/common/lib/components/flex/Centered';
66
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
77
import { Button } from '@codesandbox/common/lib/components/Button';
88

9-
import SandboxInfo from './SandboxInfo';
9+
import { SandboxInfo } from './SandboxInfo';
1010
import ShowcasePreview from '../../common/ShowcasePreview';
1111

1212
import { ErrorTitle } from './elements';
1313

14-
export const Showcase: React.FC<{}> = () => {
14+
export const Showcase: FunctionComponent = () => {
1515
const {
1616
state: {
1717
profile,
1818
profile: { isLoadingProfile },
1919
preferences: { settings },
20-
isLoggedIn,
2120
},
2221
actions: {
2322
profile: { selectSandboxClicked },
@@ -62,13 +61,15 @@ export const Showcase: React.FC<{}> = () => {
6261
</Button>
6362
)}
6463
</Margin>
64+
6565
<Margin top={2} style={{ width: '100%' }}>
6666
<Column alignItems="initial">
6767
<div style={{ flex: 2 }}>
6868
<ShowcasePreview sandbox={sandbox} settings={settings} />
6969
</div>
70+
7071
<div style={{ flex: 1 }}>
71-
<SandboxInfo sandbox={sandbox} isLoggedIn={isLoggedIn} />
72+
<SandboxInfo sandbox={sandbox} />
7273
</div>
7374
</Column>
7475
</Margin>

0 commit comments

Comments
 (0)