Skip to content

Commit b4e8098

Browse files
authored
Semantic changes to prepare for embed seo (codesandbox#3687)
1 parent 7c97774 commit b4e8098

File tree

6 files changed

+53
-41
lines changed

6 files changed

+53
-41
lines changed

packages/app/src/embed/components/Sidebar/Dependencies/elements.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ export const Row = styled.div(
1515
lineHeight: '24px',
1616
})
1717
);
18+
19+
export const Link = styled.a(
20+
css({
21+
color: 'inherit',
22+
textDecoration: 'none',
23+
})
24+
);

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { formatVersion } from '@codesandbox/common/lib/utils/ci';
3-
import { Container, Row } from './elements';
3+
import { Container, Row, Link } from './elements';
44

55
function Dependencies({ sandbox }) {
66
let { npmDependencies } = sandbox;
@@ -23,7 +23,13 @@ function Dependencies({ sandbox }) {
2323
<Container>
2424
{Object.keys(npmDependencies).map(dep => (
2525
<Row key={dep}>
26-
<span>{dep}</span>
26+
<Link
27+
href={`https://npmjs.com/package/${dep}`}
28+
target="_blank"
29+
rel="noopener noreferrer"
30+
>
31+
{dep}
32+
</Link>
2733
<span>{formatVersion(npmDependencies[dep])}</span>
2834
</Row>
2935
))}

packages/app/src/embed/components/Sidebar/SandboxInfo/elements.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const Container = styled.div(
99
})
1010
);
1111

12-
export const Title = styled.h2(
12+
export const Title = styled.h1(
1313
css({
1414
fontSize: 3,
1515
fontWeight: 'medium',
@@ -18,9 +18,10 @@ export const Title = styled.h2(
1818
})
1919
);
2020

21-
export const Description = styled.div(
21+
export const Description = styled.h2(
2222
css({
2323
fontSize: 2,
24+
fontWeight: 'normal',
2425
color: 'sideBar.foreground',
2526
marginBottom: 4,
2627
})
@@ -30,6 +31,7 @@ export const Stats = styled(CommonStats)(
3031
css({
3132
fontSize: 2,
3233
color: 'grays.400',
34+
marginBottom: 2,
3335
// ouch ouch ouch, modifying a child of
3436
// a common element is just pure evil
3537
// this will definitely break on the
@@ -41,3 +43,25 @@ export const Stats = styled(CommonStats)(
4143
},
4244
})
4345
);
46+
47+
export const Button = styled.a(
48+
css({
49+
transition: '0.3s ease background-color',
50+
backgroundColor: theme => (theme.light ? 'grays.200' : 'grays.500'),
51+
padding: 2,
52+
display: 'block',
53+
color: theme => (theme.light ? 'grays.800' : 'white'),
54+
border: 'none',
55+
outline: 'none',
56+
borderRadius: 2,
57+
width: '100%',
58+
fontSize: 3,
59+
boxSizing: 'border-box',
60+
cursor: 'pointer',
61+
textDecoration: 'none',
62+
textAlign: 'center',
63+
':hover': {
64+
backgroundColor: theme => (theme.light ? 'grays.300' : 'grays.600'),
65+
},
66+
})
67+
);

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Sandbox } from '@codesandbox/common/lib/types';
22
import { getSandboxName } from '@codesandbox/common/lib/utils/get-sandbox-name';
3+
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
34
import React, { FunctionComponent } from 'react';
45

56
import AvatarBlock from '../AvatarBlock';
67

7-
import { Container, Description, Stats, Title } from './elements';
8+
import { Container, Description, Stats, Title, Button } from './elements';
89

910
type Props = {
1011
sandbox: Sandbox;
@@ -23,6 +24,13 @@ export const SandboxInfo: FunctionComponent<Props> = ({ sandbox }) => {
2324
/>
2425
)}
2526
<Stats {...sandbox} />
27+
<Button
28+
href={sandboxUrl(sandbox) + '?from-embed'}
29+
target="_blank"
30+
rel="noreferrer noopener"
31+
>
32+
Edit Sandbox
33+
</Button>
2634
</Container>
2735
);
2836
};

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,3 @@ export const Container = styled.div(
1919
height: isIOS ? '100%' : '100vh',
2020
})
2121
);
22-
23-
export const Button = styled.a(
24-
css({
25-
transition: '0.3s ease background-color',
26-
backgroundColor: theme => (theme.light ? 'grays.200' : 'grays.500'),
27-
padding: 2,
28-
display: 'block',
29-
color: theme => (theme.light ? 'grays.800' : 'white'),
30-
border: 'none',
31-
outline: 'none',
32-
borderRadius: 2,
33-
width: '100%',
34-
fontSize: 3,
35-
boxSizing: 'border-box',
36-
cursor: 'pointer',
37-
textDecoration: 'none',
38-
textAlign: 'center',
39-
':hover': {
40-
backgroundColor: theme => (theme.light ? 'grays.300' : 'grays.600'),
41-
},
42-
})
43-
);

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import * as React from 'react';
22
import type { Sandbox } from '@codesandbox/common/lib/types';
33

4-
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
5-
import { sandboxUrl } from '@codesandbox/common/lib/utils/url-generator';
64
import Section from './Section';
75
import { SandboxInfo } from './SandboxInfo';
86
import FileTree from './FileTree';
97
import Dependencies from './Dependencies';
108
import ExternalResources from './ExternalResources';
119

12-
import { Container, Button } from './elements';
10+
import { Container } from './elements';
1311

1412
type Props = {
1513
sandbox: Sandbox,
@@ -23,14 +21,15 @@ function Sidebar({ sandbox, setCurrentModule, currentModule }: Props) {
2321
<Section title="CodeSandbox" openByDefault>
2422
<SandboxInfo sandbox={sandbox} />
2523
</Section>
24+
2625
<Section title="Files" openByDefault>
2726
<FileTree
2827
sandbox={sandbox}
2928
currentModuleId={currentModule}
3029
setCurrentModuleId={setCurrentModule}
3130
/>
3231
</Section>
33-
<Section title="Dependencies">
32+
<Section title="Dependencies" openByDefault>
3433
<Dependencies sandbox={sandbox} />
3534
</Section>
3635
<Section
@@ -39,16 +38,6 @@ function Sidebar({ sandbox, setCurrentModule, currentModule }: Props) {
3938
>
4039
<ExternalResources sandbox={sandbox} />
4140
</Section>
42-
43-
<Margin horizontal={0.5} vertical={1}>
44-
<Button
45-
href={sandboxUrl(sandbox) + '?from-embed'}
46-
target="_blank"
47-
rel="noreferrer noopener"
48-
>
49-
Edit Sandbox
50-
</Button>
51-
</Margin>
5241
</Container>
5342
);
5443
}

0 commit comments

Comments
 (0)