Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
fix: all storybook thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Apr 27, 2020
1 parent e811c84 commit 03cbbaf
Show file tree
Hide file tree
Showing 24 changed files with 29 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
BoxPlotChartPlugin,
LegacyBoxPlotChartPlugin,
} from '@superset-ui/preset-chart-xy';
import { BoxPlotChartPlugin, LegacyBoxPlotChartPlugin } from '@superset-ui/preset-chart-xy';
import { BOX_PLOT_PLUGIN_LEGACY_TYPE, BOX_PLOT_PLUGIN_TYPE } from './constants';
new LegacyBoxPlotChartPlugin().configure({ key: BOX_PLOT_PLUGIN_LEGACY_TYPE }).register();
new BoxPlotChartPlugin().configure({ key: BOX_PLOT_PLUGIN_TYPE }).register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ export { default as withLabelFlush } from './stories/flush';
export { default as withMissingData } from './stories/missing';
export { default as legacyShim } from './stories/legacy';
export { default as withTimeShift } from './stories/timeShift';

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { SuperChart } from '@superset-ui/chart';
import { radios } from '@storybook/addon-knobs';
import data from '../data/data';
Expand All @@ -21,11 +21,7 @@ export default () => (
},
axis: {
orient: radios('x.axis.orient', { top: 'top', bottom: 'bottom' }, 'bottom'),
title: radios(
'x.axis.title',
{ enable: 'Time', disable: '', '': undefined },
'Time',
),
title: radios('x.axis.title', { enable: 'Time', disable: '', '': undefined }, 'Time'),
},
},
y: {
Expand All @@ -40,11 +36,7 @@ export default () => (
{ left: 'left', right: 'right', '': undefined },
'left',
),
title: radios(
'y.axis.title',
{ enable: 'Score', disable: '', '': undefined },
'Score',
),
title: radios('y.axis.title', { enable: 'Score', disable: '', '': undefined }, 'Score'),
},
},
stroke: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { SuperChart } from '@superset-ui/chart';
import { radios } from '@storybook/addon-knobs';
import rawData from '../data/data';
Expand Down Expand Up @@ -30,11 +30,7 @@ export default () => (
axis: {
tickCount: 6,
orient: radios('x.axis.orient', { top: 'top', bottom: 'bottom' }, 'bottom'),
title: radios(
'x.axis.title',
{ enable: 'Time', disable: '', '': undefined },
'Time',
),
title: radios('x.axis.title', { enable: 'Time', disable: '', '': undefined }, 'Time'),
},
},
y: {
Expand Down Expand Up @@ -64,7 +60,8 @@ export default () => (
},
},
}}
/>,
/>
,
<SuperChart
key="line2"
chartType={LINE_PLUGIN_TYPE}
Expand All @@ -85,11 +82,7 @@ export default () => (
labelFlush: 5,
tickCount: 6,
orient: radios('x.axis.orient', { top: 'top', bottom: 'bottom' }, 'bottom'),
title: radios(
'x.axis.title',
{ enable: 'Time', disable: '', '': undefined },
'Time',
),
title: radios('x.axis.title', { enable: 'Time', disable: '', '': undefined }, 'Time'),
},
},
y: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { SuperChart } from '@superset-ui/chart';
import data from '../data/legacyData';
import { LINE_PLUGIN_LEGACY_TYPE } from '../constants';
Expand Down Expand Up @@ -33,7 +33,8 @@ export default () => (
yAxisShowminmax: false,
yLogScale: false,
}}
/>,
/>
,
<SuperChart
key="line2"
chartType={LINE_PLUGIN_LEGACY_TYPE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const missing = () => (
},
},
}}
/>,
/>
);

export default missing;
export default missing;
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
// },
// storyName: 'Queries',
// storyPath: 'preset-chart-xy|LineChartPlugin',
// })
// })
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { SuperChart } from '@superset-ui/chart';
import data from '../data/data2';
import { LINE_PLUGIN_TYPE } from '../constants';
Expand Down Expand Up @@ -74,5 +74,5 @@ export default () => (
},
},
}}
/>,
/>
);
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
ScatterPlotChartPlugin,
LegacyScatterPlotChartPlugin,
} from '@superset-ui/preset-chart-xy';
import { ScatterPlotChartPlugin, LegacyScatterPlotChartPlugin } from '@superset-ui/preset-chart-xy';
import { SCATTER_PLOT_PLUGIN_TYPE, SCATTER_PLOT_PLUGIN_LEGACY_TYPE } from './constants';

new LegacyScatterPlotChartPlugin().configure({ key: SCATTER_PLOT_PLUGIN_LEGACY_TYPE }).register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default () => (
type: 'linear',
},
axis: {
orient: radios('x.axis.orient', ['top', 'bottom'], 'bottom'),
orient: radios('x.axis.orient', { top: 'top', bottom: 'bottom' }, 'bottom'),
},
},
y: {
Expand All @@ -33,7 +33,7 @@ export default () => (
type: 'linear',
},
axis: {
orient: radios('y.axis.orient', ['left', 'right'], 'left'),
orient: radios('y.axis.orient', { left: 'left', right: 'right' }, 'left'),
},
},
fill: {
Expand All @@ -44,5 +44,5 @@ export default () => (
group: [{ field: 'country_name', title: 'Country' }],
},
}}
/>,
/>
);
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default () => (
type: 'linear',
},
axis: {
orient: radios('x.axis.orient', ['top', 'bottom'], 'bottom'),
orient: radios('x.axis.orient', { top: 'top', bottom: 'bottom' }, 'bottom'),
},
},
y: {
Expand All @@ -33,7 +33,7 @@ export default () => (
type: 'linear',
},
axis: {
orient: radios('y.axis.orient', ['left', 'right'], 'left'),
orient: radios('y.axis.orient', { left: 'left', right: 'right' }, 'left'),
},
},
size: {
Expand Down
10 changes: 6 additions & 4 deletions plugins/plugin-chart-word-cloud/src/chart/WordCloud.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export default class WordCloud extends React.PureComponent<
WordCloudProps & typeof defaultProps,
State
> {
isMounted: boolean = false;
// Cannot name it isMounted because of conflict
// with React's component function name
isComponentMounted: boolean = false;

state: State = {
words: [],
Expand All @@ -50,7 +52,7 @@ export default class WordCloud extends React.PureComponent<
static defaultProps = defaultProps;

componentDidMount() {
this.isMounted = true;
this.isComponentMounted = true;
this.update();
}

Expand All @@ -69,11 +71,11 @@ export default class WordCloud extends React.PureComponent<
}

componentWillUnmount() {
this.isMounted = false;
this.isComponentMounted = false;
}

setWords = (words: Word[]) => {
if (this.isMounted) {
if (this.isComponentMounted) {
this.setState({ words });
}
};
Expand Down

0 comments on commit 03cbbaf

Please sign in to comment.