Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 890d15c

Browse files
prettify remaining codebase
1 parent c9b155b commit 890d15c

File tree

6 files changed

+87
-93
lines changed

6 files changed

+87
-93
lines changed

‎example/src/components/code.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React, {Component} from "react";
2-
import CodeMirror from "react-codemirror2";
3-
require("../../../node_modules/codemirror/mode/javascript/javascript");
1+
import React, {Component} from 'react';
2+
import CodeMirror from 'react-codemirror2';
3+
require('../../../node_modules/codemirror/mode/javascript/javascript');
44

5-
import styles from "./code.css";
5+
import styles from './code.css';
66

7-
require("insert-css")(`
7+
require('insert-css')(`
88
.ReactCodeMirror,
99
.CodeMirror {
1010
height: 100%;
@@ -14,16 +14,16 @@ require("insert-css")(`
1414
export default class Code extends Component {
1515
render() {
1616
const classes = [styles.codeContainer];
17-
if (!this.props.valid) classes.push(styles["codeContainer--invalid"]);
17+
if (!this.props.valid) classes.push(styles['codeContainer--invalid']);
1818

1919
return (
20-
<div className={classes.join(" ")}>
20+
<div className={classes.join(' ')}>
2121
<CodeMirror
2222
value={this.props.value}
2323
onValueChange={this.props.onChange}
2424
options={{
2525
mode: {
26-
name: "javascript",
26+
name: 'javascript',
2727
json: true,
2828
},
2929
}}

‎example/src/components/plot.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React from "react";
2-
import styles from "./plot.css";
1+
import React from 'react';
2+
import styles from './plot.css';
33

4-
import PlotComponent from "../../../src/react-plotly.js";
4+
import PlotComponent from '../../../src/react-plotly.js';
55

66
export default class Plot extends React.Component {
77
shouldComponentUpdate(nextProps) {
@@ -17,9 +17,9 @@ export default class Plot extends React.Component {
1717
config={this.props.data.config}
1818
frames={this.props.data.frames}
1919
fit={this.props.fit}
20-
onClick={e => console.log("plotly_click:", e)}
21-
onHover={e => console.log("plotly_hover:", e)}
22-
onUnhover={e => console.log("plotly_unhover:", e)}
20+
onClick={e => console.log('plotly_click:', e)}
21+
onHover={e => console.log('plotly_hover:', e)}
22+
onUnhover={e => console.log('plotly_unhover:', e)}
2323
debug
2424
/>
2525
</div>

‎example/src/index.js‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import React from "react";
2-
import ReactDOM from "react-dom";
3-
import Plot from "./components/plot";
4-
import Code from "./components/code";
5-
var fs = require("fs");
6-
import path from "path";
7-
import styles from "./index.css";
8-
import Dat, {DatNumber, DatBoolean} from "react-dat-gui";
9-
import DatSelect from "./components/DatSelect.jsx";
10-
import beautify from "json-beautify";
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import Plot from './components/plot';
4+
import Code from './components/code';
5+
var fs = require('fs');
6+
import path from 'path';
7+
import styles from './index.css';
8+
import Dat, {DatNumber, DatBoolean} from 'react-dat-gui';
9+
import DatSelect from './components/DatSelect.jsx';
10+
import beautify from 'json-beautify';
1111

12-
const initialData = fs.readFileSync(__dirname + "/example.json","utf8");
12+
const initialData = fs.readFileSync(__dirname + '/example.json','utf8');
1313

1414
class App extends React.Component {
1515
state = {
1616
value: initialData,
17-
data: "",
17+
data: '',
1818
valid: true,
1919
config: {
2020
width: 0,
@@ -28,11 +28,11 @@ class App extends React.Component {
2828
this.handleCode(null, null, initialData);
2929

3030
fetch(
31-
"https://api.github.com/repositories/45646037/contents/test/image/mocks"
31+
'https://api.github.com/repositories/45646037/contents/test/image/mocks'
3232
).then(data => {
3333
data.json().then(mocks => {
3434
this.setState({
35-
mocks: [{label: "- Select -", value: ""}].concat(
35+
mocks: [{label: '- Select -', value: ''}].concat(
3636
mocks.map(m => ({
3737
label: m.name,
3838
value: m.download_url,
@@ -54,7 +54,7 @@ class App extends React.Component {
5454
data: parsed,
5555
});
5656
} catch (e) {
57-
this.setState({valid: false});
57+
this.setState({valid: false});
5858
}
5959
};
6060

@@ -107,7 +107,7 @@ class App extends React.Component {
107107
<Dat
108108
data={this.state.config}
109109
onUpdate={this.handleConfig}
110-
style={{zIndex: 100, marginTop: "1px"}}
110+
style={{zIndex: 100, marginTop: '1px'}}
111111
>
112112
<DatBoolean path="fit" label="Fit" />
113113
<DatNumber path="width" min={0} max={1024} step={1} label="Width" />
@@ -131,6 +131,6 @@ class App extends React.Component {
131131
}
132132
}
133133

134-
const root = document.createElement("div");
134+
const root = document.createElement('div');
135135
document.body.appendChild(root);
136136
ReactDOM.render(<App />, root);

‎src/__mocks__/plotly.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import EventEmitter from "event-emitter";
1+
import EventEmitter from 'event-emitter';
22
const state = {};
33

44
const ASYNC_DELAY = 1;
@@ -7,27 +7,27 @@ export default {
77
plot: jest.fn(gd => {
88
state.gd = gd;
99
setTimeout(() => {
10-
state.gd.emit("plotly_afterplot");
10+
state.gd.emit('plotly_afterplot');
1111
}, ASYNC_DELAY);
1212
}),
1313
newPlot: jest.fn(gd => {
1414
state.gd = gd;
1515
EventEmitter(state.gd);
1616

1717
setTimeout(() => {
18-
state.gd.emit("plotly_afterplot");
18+
state.gd.emit('plotly_afterplot');
1919
}, ASYNC_DELAY);
2020
}),
2121
relayout: jest.fn(gd => {
2222
state.gd = gd;
2323
setTimeout(() => {
24-
state.gd.emit("plotly_relayout");
24+
state.gd.emit('plotly_relayout');
2525
}, ASYNC_DELAY);
2626
}),
2727
restyle: jest.fn(gd => {
2828
state.gd = gd;
2929
setTimeout(() => {
30-
state.gd.emit("plotly_restyle");
30+
state.gd.emit('plotly_restyle');
3131
}, ASYNC_DELAY);
3232
}),
3333
update: jest.fn(),

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /