Skip to content

Commit 8a39c9d

Browse files
committed
fix(playground): antd styles are added as part of table scaffolding
1 parent 0cf546f commit 8a39c9d

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

packages/cubejs-playground/src/ChartRenderer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export default ChartRenderer;
6363
`;
6464
};
6565

66-
const withDomRender = (source) => `import ReactDOM from 'react-dom';
66+
const forCodeSandBox = (source) => `import ReactDOM from 'react-dom';
67+
import "antd/dist/antd.css";
6768
${source}
6869
6970
const rootElement = document.getElementById("root");
@@ -120,7 +121,7 @@ export const ChartRenderer = (props) => {
120121
error={error}
121122
sqlQuery={sqlQuery}
122123
codeExample={source}
123-
codeSandboxSource={withDomRender(source)}
124+
codeSandboxSource={forCodeSandBox(source)}
124125
dependencies={dependencies}
125126
dashboardSource={dashboardSource}
126127
chartLibrary={chartLibrary}

packages/cubejs-playground/src/libraries/bizChart.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as bizcharts from 'bizcharts';
2-
import moment from 'moment';
32

43
const chartTypeToTemplate = {
54
line: `
@@ -36,8 +35,6 @@ const chartTypeToTemplate = {
3635

3736
export const sourceCodeTemplate = ({ chartType, renderFnName }) => (
3837
`import { Chart, Axis, Tooltip, Geom, Coord, Legend } from 'bizcharts';
39-
import { Row, Col, Statistic, Table } from 'antd';
40-
import moment from 'moment';
4138
4239
const stackedChartData = (resultSet) => {
4340
const data = resultSet.pivot().map(
@@ -57,6 +54,5 @@ const ${renderFnName} = ({ resultSet }) => (${chartTypeToTemplate[chartType]}
5754
);
5855

5956
export const imports = {
60-
bizcharts,
61-
moment
57+
bizcharts
6258
};

packages/cubejs-playground/src/libraries/chartjs.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as reactChartjs from 'react-chartjs-2';
2-
import moment from 'moment';
32

43
const chartTypeToTemplate = {
54
line: `
@@ -66,7 +65,6 @@ const chartTypeToTemplate = {
6665

6766
export const sourceCodeTemplate = ({ chartType, renderFnName }) => (
6867
`import { Line, Bar, Pie } from 'react-chartjs-2';
69-
import moment from 'moment';
7068
7169
const COLORS_SERIES = ['#FF6492', '#141446', '#7A77FF'];
7270
@@ -75,6 +73,5 @@ const ${renderFnName} = ({ resultSet }) => {${chartTypeToTemplate[chartType]}
7573
);
7674

7775
export const imports = {
78-
'react-chartjs-2': reactChartjs,
79-
moment
76+
'react-chartjs-2': reactChartjs
8077
};

packages/cubejs-playground/src/libraries/tables.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const chartTypeToTemplate = {
2222

2323
export const sourceCodeTemplate = ({ chartType, renderFnName }) => (
2424
`import { Row, Col, Statistic, Table } from 'antd';
25-
import "antd/dist/antd.css";
2625
2726
const ${renderFnName} = ({ resultSet }) => (${chartTypeToTemplate[chartType]}
2827
);`

0 commit comments

Comments
 (0)