Skip to content

Commit cde33c3

Browse files
author
Ives van Hoorne
committed
Progress
1 parent b78a004 commit cde33c3

File tree

17 files changed

+436
-112
lines changed

17 files changed

+436
-112
lines changed

packages/app/src/app/components/Preview/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ class BasePreview extends React.Component<Props, State> {
6565
if (props.delay) {
6666
this.executeCode = debounce(this.executeCode, 800);
6767
}
68-
69-
frames = [];
7068
}
7169

7270
static defaultProps = {
File renamed without changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const gulp = require('gulp');
2+
const concat = require('gulp-concat');
3+
const sass = require('gulp-sass');
4+
5+
gulp.task('sass', () =>
6+
gulp
7+
.src('./src/**/*.scss')
8+
.pipe(sass().on('error', sass.logError))
9+
.pipe(concat('styles.css'))
10+
.pipe(gulp.dest('./dist/'))
11+
);
12+
13+
gulp.task('sass:watch', () => gulp.watch('./src/**/*.scss', ['sass']));

packages/react-sandpack/package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
"scripts": {
2121
"lint": "tslint -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
2222
"prebuild": "rimraf dist",
23-
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
24-
"start": "rollup -c rollup.config.ts -w",
23+
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src && gulp sass",
24+
"start": "npm-run-all --parallel watch:**",
25+
"watch:rollup": "rollup -c rollup.config.ts -w",
26+
"watch:gulp": "gulp sass:watch",
2527
"test": "jest",
2628
"test:watch": "jest --watch",
2729
"test:prod": "npm run lint && npm run test -- --coverage --no-cache",
@@ -75,7 +77,8 @@
7577
},
7678
"dependencies": {
7779
"codesandbox-import-utils": "^1.1.21",
78-
"react-broadcast": "^0.6.2"
80+
"react-broadcast": "^0.6.2",
81+
"rollup-plugin-scss": "^0.4.0"
7982
},
8083
"peerDependencies": {
8184
"react": "^16.0.0"
@@ -92,17 +95,22 @@
9295
"coveralls": "^3.0.0",
9396
"cross-env": "^5.0.1",
9497
"cz-conventional-changelog": "^2.0.0",
98+
"gulp": "^3.9.1",
99+
"gulp-concat": "^2.6.1",
100+
"gulp-sass": "^3.1.0",
95101
"husky": "^0.14.0",
96102
"jest": "^22.0.2",
97103
"lint-staged": "^7.0.0",
98104
"lodash.camelcase": "^4.3.0",
105+
"npm-run-all": "^4.1.2",
99106
"prettier": "^1.4.4",
100107
"prompt": "^1.0.0",
101108
"replace-in-file": "^3.0.0-beta.2",
102109
"rimraf": "^2.6.1",
103110
"rollup": "^0.55.4",
104111
"rollup-plugin-commonjs": "^8.0.2",
105112
"rollup-plugin-node-resolve": "^3.0.0",
113+
"rollup-plugin-sass": "^0.6.0",
106114
"rollup-plugin-sourcemaps": "^0.4.2",
107115
"rollup-plugin-typescript2": "^0.11.1",
108116
"semantic-release": "^12.4.1",

packages/react-sandpack/src/components/BrowserPreview/BrowserPreview.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ import * as React from 'react';
22

33
import SandpackConsumer from '../SandpackConsumer';
44
import Preview from '../Preview';
5+
import Navigator from '../Navigator';
56

6-
export default class BrowserPreview extends React.PureComponent {
7+
import cn from '../../utils/cn';
8+
9+
export interface Props {}
10+
11+
export default class BrowserPreview extends React.PureComponent<Props> {
712
render() {
813
return (
9-
<div>
10-
This is the navigation
14+
<React.Fragment>
15+
<Navigator />
1116
<Preview />
12-
</div>
17+
</React.Fragment>
1318
);
1419
}
1520
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.sandpack-BrowserPreview__navigation {
2+
color: red;
3+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as React from 'react';
2+
import { listen } from 'codesandbox-api';
3+
import withSandpack from '../../utils/with-sandpack';
4+
5+
import { ISandpackContext } from '../../types';
6+
7+
interface Props {
8+
sandpack: ISandpackContext;
9+
test: string;
10+
}
11+
12+
class Navigator extends React.Component<Props> {
13+
listener: Function;
14+
15+
constructor(props: Props) {
16+
super(props);
17+
this.listener = listen(this.handleMessage);
18+
}
19+
20+
componentWillUnmount() {
21+
this.listener();
22+
}
23+
24+
handleMessage = (message: any) => {
25+
console.log(message);
26+
};
27+
28+
render() {
29+
return <div />;
30+
}
31+
}
32+
33+
export default withSandpack(Navigator);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Navigator from './Navigator';
2+
3+
export default Navigator;

packages/react-sandpack/src/components/OpenInCodeSandbox/OpenInCodeSandbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { getParameters } from 'codesandbox-import-utils/lib/api/define';
3-
import { IFileProps } from '../types';
3+
import { IFileProps } from '../../types';
44

55
export default class OpenInCodeSandbox extends React.Component<IFileProps> {
66
static defaultProps = {

packages/react-sandpack/src/components/SandpackConsumer/SandpackConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { Subscriber } from 'react-broadcast';
33

4-
import { ISandpackContext } from '../types';
4+
import { ISandpackContext } from '../../types';
55

66
export interface Props {
77
children: (state: ISandpackContext) => React.ReactNode;

0 commit comments

Comments
 (0)