Skip to content

Commit 30efa1c

Browse files
aulneauVeraZab
authored andcommitted
cleanup for tests
1 parent bda60a9 commit 30efa1c

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

src/PlotlyEditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import DefaultEditor from './DefaultEditor';
22
import PropTypes from 'prop-types';
3-
import React, {Component, Fragment} from 'react';
3+
import React, {Component} from 'react';
44
import {bem} from './lib';
55
import {maybeClearAxisTypes} from './shame';
66
import {EDITOR_ACTIONS} from './lib/constants';

src/components/containers/Modal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {Component, Fragment} from 'react';
1+
import React, {Component} from 'react';
22
import PropTypes from 'prop-types';
33
import {CloseIcon} from 'plotly-icons';
44

src/components/widgets/TraceTypeSelector.js

+11-16
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ const actions = ({value}) => [
1212
},
1313
{
1414
label: `View tutorials on this chart type.`,
15-
href: `#`, // update
15+
href: `#`,
1616
icon: <ThumnailViewIcon />,
1717
},
1818
{
1919
label: `See a basic example.`,
20-
href: `#`, // update
20+
href: `#`,
2121
icon: <GraphIcon />,
2222
},
2323
];
2424

25-
/**
26-
* This renders our item actions
27-
*/
2825
const renderActionItems = (actionItems, item) =>
2926
actionItems(item).map((action, i) => (
3027
<a
@@ -40,18 +37,15 @@ const renderActionItems = (actionItems, item) =>
4037
</a>
4138
));
4239

43-
/**
44-
* Trace Type Item
45-
*/
46-
const Item = ({item, active, handleClick}) => {
40+
const Item = ({item, active, handleClick, actions, showActions}) => {
4741
const {label, value, icon} = item;
4842
return (
4943
<div
5044
className={`trace-item${active ? ' trace-item--active' : ''}`}
5145
onClick={() => handleClick()}
5246
>
5347
<div className="trace-item__actions">
54-
{actions ? renderActionItems(actions, item) : null}
48+
{actions && showActions ? renderActionItems(actions, item) : null}
5549
</div>
5650
<div className="trace-item__image">
5751
<img src={`/_temp/ic-${icon ? icon : value}.svg`} />
@@ -61,9 +55,6 @@ const Item = ({item, active, handleClick}) => {
6155
);
6256
};
6357

64-
/**
65-
* Trace Type Selector
66-
*/
6758
class TraceTypeSelector extends Component {
6859
selectAndClose(value) {
6960
const computedValue = traceTypeToPlotlyInitFigure(value);
@@ -81,9 +72,9 @@ class TraceTypeSelector extends Component {
8172
);
8273

8374
const MAX_ITEMS = 6;
75+
8476
let columnClasses = 'trace-grid__column';
8577

86-
// If the category has more than 6 items, it will span 2 columns
8778
if (items.length > MAX_ITEMS) {
8879
columnClasses += ' trace-grid__column--double';
8980
}
@@ -97,6 +88,8 @@ class TraceTypeSelector extends Component {
9788
key={item.value}
9889
active={fullValue === item.value}
9990
item={item}
91+
actions={actions}
92+
showActions={false}
10093
handleClick={() => this.selectAndClose(item.value)}
10194
/>
10295
))}
@@ -144,8 +137,6 @@ class TraceTypeButton extends React.Component {
144137
}
145138
}
146139

147-
export const TraceTypeSelectorButton = localize(TraceTypeButton);
148-
149140
TraceTypeSelector.propTypes = {
150141
updateContainer: PropTypes.func,
151142
fullValue: PropTypes.string,
@@ -165,6 +156,10 @@ Item.propTypes = {
165156
item: PropTypes.object,
166157
active: PropTypes.bool,
167158
handleClick: PropTypes.func,
159+
actions: PropTypes.array,
160+
showActions: PropTypes.bool,
168161
};
169162

170163
export default localize(TraceTypeSelector);
164+
165+
export const TraceTypeSelectorButton = localize(TraceTypeButton);

0 commit comments

Comments
 (0)