Skip to content

Commit 4609d08

Browse files
SaraVieiraCompuIves
authored andcommitted
1 parent 271bb38 commit 4609d08

File tree

6 files changed

+351
-349
lines changed

6 files changed

+351
-349
lines changed

packages/app/src/app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<script>
2727
WebFont.load({
2828
google: {
29-
families: ['Source Code Pro:500', 'Roboto:300,400,500,700']
29+
families: ['Source Code Pro:500', 'Roboto:300,400,500,700', 'Poppins:300,400,500,700']
3030
}
3131
});
3232
</script>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React, { Component, Fragment } from 'react';
2+
import Down from 'react-icons/lib/fa/angle-down';
3+
import Up from 'react-icons/lib/fa/angle-up';
4+
import { Spring, animated } from 'react-spring';
5+
import { Title } from './elements';
6+
7+
export default class extends Component {
8+
state = { open: this.props.open || false };
9+
10+
toggleShow = () => this.setState(({ open }) => ({ open: !open }));
11+
12+
render() {
13+
const { children, title } = this.props;
14+
const { open } = this.state;
15+
return (
16+
<Fragment>
17+
<Title onClick={() => this.toggleShow()}>
18+
{open ? <Up /> : <Down />}
19+
{title}
20+
</Title>
21+
<Spring
22+
from={{ height: 'auto' }}
23+
to={{
24+
height: open ? 'auto' : 0,
25+
overflow: 'hidden',
26+
}}
27+
>
28+
{props => <animated.div style={props}>{children}</animated.div>}
29+
</Spring>
30+
</Fragment>
31+
);
32+
}
33+
}

packages/app/src/app/pages/common/Modals/ShareModal/elements.js

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const FilesContainer = styled.div`
77
`;
88

99
export const PaddedPreference = styled(Preference)`
10-
color: rgba(255, 255, 255, 0.6);
10+
color: #e5e5e5;
1111
padding-bottom: 1rem;
1212
1313
&:last-child {
@@ -19,39 +19,27 @@ export const ShareOptions = styled.div`
1919
font-size: 0.875rem;
2020
color: rgba(255, 255, 255, 0.8);
2121
padding: 1rem;
22-
background-color: ${props => props.theme.background2};
23-
24-
h3 {
25-
text-align: center;
26-
margin: 0;
27-
margin-bottom: 1rem;
28-
font-weight: 400;
29-
}
22+
background-color: #1c2022;
3023
`;
3124

3225
export const Inputs = styled.div`
3326
margin-top: 0.5rem;
34-
input {
27+
color: #e5e5e5;
28+
29+
input,
30+
textarea {
3531
border: none;
3632
outline: none;
37-
width: 100%;
38-
background-color: rgba(255, 255, 255, 0.1);
39-
color: white;
33+
background: #333739;
34+
color: #e5e5e5;
4035
padding: 0.2rem;
4136
margin: 0.5rem 0;
4237
border-radius: 4px;
38+
width: 100%;
4339
}
4440
4541
textarea {
46-
border: none;
47-
outline: none;
48-
width: 100%;
49-
background-color: rgba(255, 255, 255, 0.1);
50-
color: white;
51-
padding: 0.2rem;
52-
margin: 0.5rem 0;
5342
height: 100px;
54-
border-radius: 4px;
5543
}
5644
`;
5745

@@ -61,32 +49,38 @@ export const LinkName = styled.div`
6149
margin-bottom: 0;
6250
`;
6351

64-
export const Divider = styled.div`
65-
display: flex;
66-
flex-direction: row;
67-
width: 100%;
52+
export const ButtonContainer = styled.div`
53+
margin-top: 0.25rem;
6854
`;
6955

70-
export const Column = styled.div`
56+
export const Title = styled.h4`
57+
font-family: 'Roboto';
58+
font-weight: 500;
59+
font-size: 18px;
60+
padding-bottom: 20px;
61+
margin: 0;
62+
padding-top: 20px;
63+
cursor: pointer;
7164
display: flex;
72-
flex-direction: column;
73-
flex: 100%;
74-
75-
color: rgba(255, 255, 255, 0.8);
76-
margin: 0 0.75rem;
65+
align-items: center;
7766
78-
h4 {
79-
margin: 1rem 0;
80-
font-weight: 400;
67+
svg {
68+
margin-right: 10px;
8169
}
8270
`;
8371

84-
export const ButtonContainer = styled.div`
85-
margin-top: 0.25rem;
72+
export const Wrapper = styled.section`
73+
display: grid;
74+
grid-gap: 30px;
75+
grid-template-columns: repeat(2, 1fr);
8676
`;
8777

88-
export const ButtonName = styled.div`
89-
margin: 0.5rem 0;
90-
font-weight: 500;
91-
margin-bottom: 0;
78+
export const SideTitle = styled.span`
79+
font-family: 'Poppins';
80+
font-weight: bold;
81+
font-size: 20px;
82+
margin-top: 20px;
83+
margin-bottom: 0px;
84+
color: #e5e5e5;
85+
display: block;
9286
`;
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { getModulePath } from 'common/sandbox/modules';
2+
import {
3+
optionsToParameterizedUrl,
4+
protocolAndHost,
5+
sandboxUrl,
6+
embedUrl,
7+
} from 'common/utils/url-generator';
8+
9+
export const BUTTON_URL = `${
10+
process.env.CODESANDBOX_HOST
11+
}/static/img/play-codesandbox.svg`;
12+
13+
export const VIEW_OPTIONS = ['Editor + Preview', 'Preview', 'Editor'];
14+
15+
const getOptionsUrl = (sandbox, mainModule, state) => {
16+
const {
17+
defaultModule,
18+
view,
19+
testsView,
20+
autoResize,
21+
hideNavigation,
22+
isCurrentModuleView,
23+
fontSize,
24+
initialPath,
25+
enableEslint,
26+
useCodeMirror,
27+
expandDevTools,
28+
} = state;
29+
30+
const options = {
31+
view: view !== VIEW_OPTIONS[0] ? view.toLowerCase() : null,
32+
previewwindow: testsView ? 'tests' : null,
33+
autoresize: autoResize ? 1 : null,
34+
hidenavigation: hideNavigation ? 1 : null,
35+
moduleview: isCurrentModuleView ? 1 : null,
36+
eslint: enableEslint ? 1 : null,
37+
codemirror: useCodeMirror ? 1 : null,
38+
expanddevtools: expandDevTools ? 1 : null,
39+
fontsize: fontSize !== 14 ? fontSize : 14,
40+
initialpath: initialPath || null,
41+
};
42+
43+
const mainModuleId = mainModule.id;
44+
if (defaultModule && defaultModule !== mainModuleId) {
45+
const modulePath = getModulePath(
46+
sandbox.modules,
47+
sandbox.directories,
48+
defaultModule
49+
);
50+
options.module = modulePath;
51+
}
52+
53+
return optionsToParameterizedUrl(options);
54+
};
55+
56+
export const getEditorUrl = (sandbox, mainModule, state) =>
57+
protocolAndHost() +
58+
sandboxUrl(sandbox) +
59+
getOptionsUrl(sandbox, mainModule, state);
60+
61+
export const getEmbedUrl = (sandbox, mainModule, state) =>
62+
protocolAndHost() +
63+
embedUrl(sandbox) +
64+
getOptionsUrl(sandbox, mainModule, state);
65+
66+
export const getIframeScript = (sandbox, mainModule, state) =>
67+
`<iframe src="${getEmbedUrl(
68+
sandbox,
69+
mainModule,
70+
state
71+
)}" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>`;
72+
73+
// eslint-disable-next-line
74+
export const getButtonMarkdown = (sandbox, mainModule, state) => {
75+
return `[![Edit ${sandbox.title ||
76+
sandbox.id}](${BUTTON_URL})](${getEditorUrl(sandbox, mainModule, state)})`;
77+
};
78+
79+
// eslint-disable-next-line
80+
export const getButtonHTML = (sandbox, mainModule, state) => {
81+
return `<a href="${getEditorUrl(sandbox, mainModule, state)}">
82+
<img alt="Edit ${sandbox.title || sandbox.id}" src="${BUTTON_URL}">
83+
</a>
84+
`;
85+
};

0 commit comments

Comments
 (0)