Skip to content

Commit

Permalink
fix(playground): antd styles are added as part of table scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Oct 2, 2019
1 parent 0cf546f commit 8a39c9d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
5 changes: 3 additions & 2 deletions packages/cubejs-playground/src/ChartRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default ChartRenderer;
`;
};

const withDomRender = (source) => `import ReactDOM from 'react-dom';
const forCodeSandBox = (source) => `import ReactDOM from 'react-dom';
import "antd/dist/antd.css";
${source}
const rootElement = document.getElementById("root");
Expand Down Expand Up @@ -120,7 +121,7 @@ export const ChartRenderer = (props) => {
error={error}
sqlQuery={sqlQuery}
codeExample={source}
codeSandboxSource={withDomRender(source)}
codeSandboxSource={forCodeSandBox(source)}
dependencies={dependencies}
dashboardSource={dashboardSource}
chartLibrary={chartLibrary}
Expand Down
6 changes: 1 addition & 5 deletions packages/cubejs-playground/src/libraries/bizChart.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as bizcharts from 'bizcharts';
import moment from 'moment';

const chartTypeToTemplate = {
line: `
Expand Down Expand Up @@ -36,8 +35,6 @@ const chartTypeToTemplate = {

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

export const imports = {
bizcharts,
moment
bizcharts
};
5 changes: 1 addition & 4 deletions packages/cubejs-playground/src/libraries/chartjs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as reactChartjs from 'react-chartjs-2';
import moment from 'moment';

const chartTypeToTemplate = {
line: `
Expand Down Expand Up @@ -66,7 +65,6 @@ const chartTypeToTemplate = {

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

export const imports = {
'react-chartjs-2': reactChartjs,
moment
'react-chartjs-2': reactChartjs
};
1 change: 0 additions & 1 deletion packages/cubejs-playground/src/libraries/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const chartTypeToTemplate = {

export const sourceCodeTemplate = ({ chartType, renderFnName }) => (
`import { Row, Col, Statistic, Table } from 'antd';
import "antd/dist/antd.css";
const ${renderFnName} = ({ resultSet }) => (${chartTypeToTemplate[chartType]}
);`
Expand Down

0 comments on commit 8a39c9d

Please sign in to comment.