Skip to content

Commit c12f5e2

Browse files
committed
Add option to export to github even if it's forked from git
Fixes codesandbox#1298
1 parent 2cf33c4 commit c12f5e2

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/CreateRepo/elements.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
import styled from 'styled-components';
2-
import Margin from 'common/components/spacing/Margin';
3-
4-
export const Container = Margin.extend`
5-
color: ${props =>
6-
props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'};
7-
`;
82

93
export const Error = styled.div`
104
margin: 1rem;

packages/app/src/app/pages/Sandbox/Editor/Workspace/CreateRepo/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Button from 'app/components/Button';
77

88
import { WorkspaceSubtitle, WorkspaceInputContainer } from '../elements';
99

10-
import { Container, Error } from './elements';
10+
import { Error } from './elements';
1111

1212
class CreateRepo extends React.Component {
1313
updateRepoTitle = e => {
@@ -19,16 +19,13 @@ class CreateRepo extends React.Component {
1919
};
2020

2121
render() {
22-
const { store } = this.props;
22+
const { store, style } = this.props;
2323
const modulesNotSaved = !store.editor.isAllModulesSynced;
2424
const repoTitle = store.git.repoTitle;
2525
const error = store.git.error;
2626

2727
return (
28-
<div>
29-
<Container margin={1} top={0.5}>
30-
Export Sandbox to GitHub
31-
</Container>
28+
<div style={style}>
3229
{modulesNotSaved && (
3330
<Error>Save your files first before exporting.</Error>
3431
)}

packages/app/src/app/pages/Sandbox/Editor/Workspace/items/GitHub/index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { inject, observer } from 'mobx-react';
33

44
import GithubIntegration from '../../../../../common/GithubIntegration';
5+
import WorkspaceItem from '../../WorkspaceItem';
56
import Git from '../../Git';
67
import CreateRepo from '../../CreateRepo';
78
import { Description } from '../../elements';
@@ -10,11 +11,16 @@ const GitHub = ({ store }) => {
1011
const sandbox = store.editor.currentSandbox;
1112

1213
return store.user.integrations.github ? ( // eslint-disable-line
13-
sandbox.originalGit ? (
14-
<Git />
15-
) : (
16-
<CreateRepo />
17-
)
14+
<React.Fragment>
15+
{sandbox.originalGit && <Git />}
16+
17+
<WorkspaceItem
18+
defaultOpen={!sandbox.originalGit}
19+
title="Export to GitHub"
20+
>
21+
<CreateRepo />
22+
</WorkspaceItem>
23+
</React.Fragment>
1824
) : (
1925
<div>
2026
<Description margin={1} top={0}>

0 commit comments

Comments
 (0)