Skip to content

Commit d9b0a99

Browse files
committed
merge and fix demo add react-prism lib
1 parent 49a8641 commit d9b0a99

File tree

8 files changed

+75
-41
lines changed

8 files changed

+75
-41
lines changed

demo/src/highmaps.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
const React = require('react');
22
// Note that HighMaps has to be in the codebase already
33
const ReactHighmaps = require('react-highcharts/ReactHighmaps.src');
4-
const Highlight = require('react-highlight');
54
const ReactDOM = require('react-dom');
65
const maps = require('./mapdata/europe');
6+
require('prismjs');
7+
require('prismjs/themes/prism.css');
8+
import PrismCode from 'react-prism'
9+
10+
import './style.css'
11+
import './tomorrow.css'
12+
13+
714

815
const config = {
916
chart: {
@@ -57,12 +64,12 @@ ReactDOM.render(
5764
);
5865

5966
ReactDOM.render(
60-
<Highlight className="jsx">{require("raw-loader!./highmaps.jsx")}</Highlight>,
67+
<PrismCode component="pre" className="language-javascript">{require("!!raw-loader!./highmaps.jsx")}</PrismCode>,
6168
document.getElementById('code-js')
6269
);
6370

6471
ReactDOM.render(
65-
<Highlight className="html">{require("raw-loader!./highmaps.html")}</Highlight>,
72+
<PrismCode component="pre" className="language-markup">{require("raw-loader!./highmaps.html")}</PrismCode>,
6673
document.getElementById('code-html')
6774
);
6875

demo/src/highstock.jsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
const React = require('react');
22
// Note that HighMaps has to be in the codebase already
33
const ReactHighstock = require('react-highcharts/ReactHighstock.src');
4-
const Highlight = require('react-highlight');
54
const ReactDOM = require('react-dom');
5+
require('prismjs');
6+
require('prismjs/themes/prism.css');
7+
import PrismCode from 'react-prism'
8+
9+
import './style.css'
10+
import './tomorrow.css'
11+
612

713
const data = [
814
[1220832000000, 22.56], [1220918400000, 21.67], [1221004800000, 21.66], [1221091200000, 21.81], [1221177600000, 21.28], [1221436800000, 20.05], [1221523200000, 19.98], [1221609600000, 18.26], [1221696000000, 19.16], [1221782400000, 20.13], [1222041600000, 18.72], [1222128000000, 18.12], [1222214400000, 18.39], [1222300800000, 18.85], [1222387200000, 18.32], [1222646400000, 15.04], [1222732800000, 16.24], [1222819200000, 15.59], [1222905600000, 14.3], [1222992000000, 13.87], [1223251200000, 14.02], [1223337600000, 12.74], [1223424000000, 12.83], [1223510400000, 12.68], [1223596800000, 13.8], [1223856000000, 15.75], [1223942400000, 14.87], [1224028800000, 13.99], [1224115200000, 14.56], [1224201600000, 13.91], [1224460800000, 14.06], [1224547200000, 13.07], [1224633600000, 13.84], [1224720000000, 14.03], [1224806400000, 13.77], [1225065600000, 13.16], [1225152000000, 14.27], [1225238400000, 14.94], [1225324800000, 15.86], [1225411200000, 15.37], [1225670400000, 15.28], [1225756800000, 15.86], [1225843200000, 14.76], [1225929600000, 14.16], [1226016000000, 14.03], [1226275200000, 13.7], [1226361600000, 13.54], [1226448000000, 12.87], [1226534400000, 13.78], [1226620800000, 12.89], [1226880000000, 12.59], [1226966400000, 12.84], [1227052800000, 12.33], [1227139200000, 11.5], [1227225600000, 11.8], [1227484800000, 13.28], [1227571200000, 12.97], [1227657600000, 13.57], [1227830400000, 13.24], [1228089600000, 12.7], [1228176000000, 13.21], [1228262400000, 13.7], [1228348800000, 13.06], [1228435200000, 13.43], [1228694400000, 14.25], [1228780800000, 14.29], [1228867200000, 14.03], [1228953600000, 13.57], [1229040000000, 14.04], [1229299200000, 13.54]
@@ -30,12 +36,12 @@ ReactDOM.render(
3036
);
3137

3238
ReactDOM.render(
33-
<Highlight className="jsx">{require("raw-loader!./highstock.jsx")}</Highlight>,
39+
<PrismCode component="pre" className="language-javascript">{require("!!raw-loader!./highstock.jsx")}</PrismCode>,
3440
document.getElementById('code-js')
3541
);
3642

3743
ReactDOM.render(
38-
<Highlight className="html">{require("raw-loader!./highstock.html")}</Highlight>,
44+
<PrismCode component="pre" className="language-markup">{require("raw-loader!./highstock.html")}</PrismCode>,
3945
document.getElementById('code-html')
4046
);
4147

demo/src/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ const React = require('react');
33
const ReactHighcharts = require('react-highcharts');
44
const Highlight = require('react-highlight');
55
const ReactDOM = require('react-dom');
6+
require('prismjs');
7+
require('prismjs/themes/prism.css');
8+
import PrismCode from 'react-prism'
9+
10+
import './style.css'
11+
import './tomorrow.css'
612

713
const config = {
814
xAxis: {
@@ -18,16 +24,14 @@ ReactDOM.render(
1824
document.getElementById('test')
1925
);
2026
ReactDOM.render(
21-
<Highlight className="jsx">{require("raw-loader!./index.jsx")}</Highlight>,
27+
<PrismCode component="pre" className="language-javascript">{require("!!raw-loader!./index.jsx")}</PrismCode>,
2228
document.getElementById('code-js')
2329
);
2430
ReactDOM.render(
25-
<Highlight className="html">{require("raw-loader!./index.html")}</Highlight>,
31+
<PrismCode component="pre" className="language-markup">{require("raw-loader!./index.html")}</PrismCode>,
2632
document.getElementById('code-html')
2733
);
2834

2935
require("file-loader?name=[name].[ext]!./index.html");
3036
require("file-loader?name=[name].[ext]!./more.html");
31-
require("file-loader?name=[name].[ext]!./style.css");
32-
require("file-loader?name=[name].[ext]!./tomorrow.css");
3337

demo/src/more.jsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ var React = require('react');
22
// Note that Highcharts has to be required separately
33
var ReactHighcharts = require('react-highcharts');
44

5-
65
// Note that Highcharts has to be in the codebase already
76
// Highcharts more
87
var HighchartsMore = require('highcharts-more');
@@ -11,31 +10,37 @@ HighchartsMore(ReactHighcharts.Highcharts);
1110
// Highcharts exporting
1211
var HighchartsExporting = require('highcharts-exporting');
1312
HighchartsExporting(ReactHighcharts.Highcharts);
14-
15-
var Highlight = require('react-highlight');
1613
var ReactDOM = require('react-dom');
1714

15+
require('prismjs');
16+
require('prismjs/themes/prism.css');
17+
import PrismCode from 'react-prism'
18+
19+
import './style.css'
20+
import './tomorrow.css'
21+
22+
1823
var config = {
19-
chart: {
20-
polar: true
21-
},
22-
xAxis: {
23-
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
24-
},
25-
series: [{
26-
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
27-
}]
24+
chart: {
25+
polar: true
26+
},
27+
xAxis: {
28+
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
29+
},
30+
series: [{
31+
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
32+
}]
2833
};
2934

3035
ReactDOM.render(
31-
<ReactHighcharts config={config}></ReactHighcharts>,
32-
document.getElementById('test')
36+
<ReactHighcharts config={config}> </ReactHighcharts>,
37+
document.getElementById('test')
3338
);
3439
ReactDOM.render(
35-
<Highlight className="jsx">{require("raw-loader!./more.jsx")}</Highlight>,
36-
document.getElementById('code-js')
40+
<PrismCode component="pre" className="language-javascript">{require("!!raw-loader!./more.jsx")}</PrismCode>,
41+
document.getElementById('code-js')
3742
);
3843
ReactDOM.render(
39-
<Highlight className="html">{require("raw-loader!./more.html")}</Highlight>,
40-
document.getElementById('code-html')
44+
<PrismCode component="pre" className="language-markup">{require("raw-loader!./more.html")}</PrismCode>,
45+
document.getElementById('code-html')
4146
);

demo/webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ module.exports = {
1717
}
1818

1919
}]
20+
},
21+
{
22+
test: /\.css$/,
23+
use: [ 'style-loader', 'css-loader' ]
2024
}
25+
2126
]
2227
},
2328
resolve: {

package.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"graph"
3636
],
3737
"devDependencies": {
38-
"babel-cli": "^6.18.0",
38+
"babel-cli": "^6.26.0",
3939
"babel-core": "^6.24.0",
4040
"babel-loader": "^7.1.2",
4141
"babel-plugin-add-module-exports": "^0.2.1",
@@ -44,25 +44,31 @@
4444
"babel-preset-react": "^6.24.1",
4545
"babel-preset-stage-2": "^6.24.1",
4646
"create-react-class": "^15.6.2",
47+
"css-loader": "^0.28.8",
4748
"exports-loader": "^0.6.4",
4849
"file-loader": "^1.1.6",
4950
"highlight.js": "^9.12.0",
5051
"imports-loader": "^0.7.1",
51-
"jsdom": "^9.9.1",
52-
"mocha": "^3.2.0",
53-
"mock-require": "^2.0.1",
54-
"nightwatch": "^0.9.6",
55-
"prop-types": "^15.5.8",
52+
"jsdom": "^11.5.1",
53+
"mocha": "^4.1.0",
54+
"mock-require": "^2.0.2",
55+
"nightwatch": "^0.9.19",
56+
"prop-types": "^15.6.0",
5657
"raw-loader": "^0.5.1",
5758
"react": "^16.2.0",
5859
"react-dom": "^16.2.0",
5960
"react-highlight": "^0.10.0",
6061
"sinon": "^4.1.3",
62+
"style-loader": "^0.19.1",
6163
"uglifyjs-webpack-plugin": "^1.1.6",
6264
"webpack": "^3.10.0",
6365
"webpack-dev-server": "^2.9.6"
6466
},
6567
"dependencies": {
66-
"highcharts": "^6.0.0"
68+
"highcharts": "^6.0.4",
69+
"prismjs": "^1.9.0",
70+
"react-highlight": "briancappello/react-highlight#react-v16-compiled",
71+
"react-prism": "^4.3.2",
72+
"refractor": "^2.2.0"
6773
}
6874
}

test/unit/simulateDOM.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
*/
1414

1515
var jsdom = require('jsdom');
16-
17-
global.document = jsdom.jsdom('<!doctype html><html><body><div id="test"></div></body></html>');
18-
var win = global.document.defaultView;
16+
const {JSDOM} = jsdom;
17+
const {document} = (new JSDOM('<!doctype html><html><body><div id="test"></div></body></html>')).window;
18+
var win = document.defaultView;
1919
global.window = global;
2020
for( var i in win ){
21-
if( i !== 'window' && win.hasOwnProperty(i)){
22-
global.window[i] = win[i];
23-
}
21+
if( i !== 'window' && win.hasOwnProperty(i)){
22+
global.window[i] = win[i];
23+
}
2424
}
2525

webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ module.exports = function (env) {
8787
loader: 'babel-loader',
8888
options: {
8989
presets: ['env', 'react', 'stage-2'],
90+
plugins: ["add-module-exports"]
9091
}
9192
}
9293
}

0 commit comments

Comments
 (0)