Skip to content

Commit 96c399f

Browse files
committed
Rename Panel/Fold/Section-> PlotlyPanel/PlotlyFold/PlotlySection
1 parent d278280 commit 96c399f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+742
-569
lines changed

examples/custom/src/CustomEditor.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import {
33
Flaglist,
44
ColorPicker,
55
ColorscalePicker,
6-
Fold,
6+
PlotlyFold,
77
PanelMenuWrapper,
88
TextEditor,
99
Radio,
1010
Dropdown,
1111
Info,
12-
Section,
12+
PlotlySection,
1313
Numeric,
1414
LayoutPanel,
1515
Button,
@@ -22,16 +22,16 @@ export default class CustomEditor extends Component {
2222
return (
2323
<PanelMenuWrapper>
2424
<TraceAccordion group="Traces" name="Style">
25-
<Section name="Colorscale" attr="marker.colorscale">
25+
<PlotlySection name="Colorscale" attr="marker.colorscale">
2626
<ColorscalePicker label="Colorscale" attr="marker.colorscale" />
27-
</Section>
27+
</PlotlySection>
2828
</TraceAccordion>
2929

3030
<LayoutPanel group="Layout" name="Style">
31-
<Fold name="Fold">
31+
<PlotlyFold name="PlotlyFold">
3232
{
33-
// At least one of the direct children of Fold must have an attr prop
34-
// for the Fold to display itself
33+
// At least one of the direct children of PlotlyFold must have an attr prop
34+
// for the PlotlyFold to display itself
3535
}
3636
<Info attr="title">
3737
<p>
@@ -42,7 +42,7 @@ export default class CustomEditor extends Component {
4242
This is an <code>Info</code> component.
4343
</p>
4444
</Info>
45-
<Section name="Section">
45+
<PlotlySection name="PlotlySection">
4646
<Numeric label="Numeric" attr="width" show units="units" />
4747
<Dropdown
4848
label="Dropdown"
@@ -80,8 +80,8 @@ export default class CustomEditor extends Component {
8080
/>
8181
<TextEditor attr="title" label="TextEditor htmlOnly" htmlOnly />
8282
<TextEditor attr="title" label="TextEditor latexOnly" latexOnly />
83-
</Section>
84-
</Fold>
83+
</PlotlySection>
84+
</PlotlyFold>
8585
</LayoutPanel>
8686
<SingleSidebarItem>
8787
<Button

src/__tests__/PlotlyEditor.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import PlotlyEditor, {Fold} from '..';
1+
import PlotlyEditor, {PlotlyFold} from '..';
22
import {configure, mount} from 'enzyme';
33
import Adapter from 'enzyme-adapter-react-16';
44
import React, {Component} from 'react';
@@ -54,7 +54,7 @@ describe('<TestApp>', () => {
5454
});
5555

5656
it('Can create and delete traces', done => {
57-
expect(app.find(Fold).length).toEqual(0);
57+
expect(app.find(PlotlyFold).length).toEqual(0);
5858

5959
app
6060
.find('.js-add-button')

src/components/containers/AnnotationAccordion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Fold from './Fold';
1+
import PlotlyFold from './PlotlyFold';
22
import TraceRequiredPanel from './TraceRequiredPanel';
33
import PropTypes from 'prop-types';
44
import React, {Component} from 'react';
55
import {connectAnnotationToLayout, localize} from 'lib';
66

7-
const AnnotationFold = connectAnnotationToLayout(Fold);
7+
const AnnotationFold = connectAnnotationToLayout(PlotlyFold);
88

99
class AnnotationAccordion extends Component {
1010
render() {

src/components/containers/AxesFold.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import AxesSelector from '../fields/AxesSelector';
2-
import Fold from './Fold';
2+
import PlotlyFold from './PlotlyFold';
33
import PropTypes from 'prop-types';
44
import React, {Component} from 'react';
55
import {connectAxesToLayout} from 'lib';
@@ -8,10 +8,10 @@ class AxesFold extends Component {
88
render() {
99
const {children, options} = this.props;
1010
return options.length && children ? (
11-
<Fold {...this.props}>
11+
<PlotlyFold {...this.props}>
1212
{options.length === 1 ? null : <AxesSelector axesOptions={options} />}
1313
{children}
14-
</Fold>
14+
</PlotlyFold>
1515
) : null;
1616
}
1717
}

src/components/containers/ImageAccordion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Fold from './Fold';
1+
import PlotlyFold from './PlotlyFold';
22
import TraceRequiredPanel from './TraceRequiredPanel';
33
import PropTypes from 'prop-types';
44
import React, {Component} from 'react';
55
import {connectImageToLayout, localize} from 'lib';
66

7-
const ImageFold = connectImageToLayout(Fold);
7+
const ImageFold = connectImageToLayout(PlotlyFold);
88

99
class ImageAccordion extends Component {
1010
render() {

src/components/containers/Fold.js renamed to src/components/containers/PlotlyFold.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
striptags,
1111
} from 'lib';
1212

13-
class Fold extends Component {
13+
class PlotlyFold extends Component {
1414
constructor(props, context) {
1515
super(props, context);
1616

@@ -136,9 +136,9 @@ class Fold extends Component {
136136
}
137137
}
138138

139-
Fold.plotly_editor_traits = {foldable: true};
139+
PlotlyFold.plotly_editor_traits = {foldable: true};
140140

141-
Fold.propTypes = {
141+
PlotlyFold.propTypes = {
142142
canDelete: PropTypes.bool,
143143
children: PropTypes.node,
144144
className: PropTypes.string,
@@ -151,11 +151,17 @@ Fold.propTypes = {
151151
name: PropTypes.string,
152152
};
153153

154-
Fold.contextTypes = Object.assign(
154+
PlotlyFold.contextTypes = Object.assign(
155155
{
156156
deleteContainer: PropTypes.func,
157157
},
158158
containerConnectedContextTypes
159159
);
160160

161-
export default localize(Fold);
161+
export default localize(PlotlyFold);
162+
163+
// just to keep naming consistent
164+
export class Fold extends PlotlyFold {}
165+
Fold.plotly_editor_traits = {
166+
foldable: true,
167+
};

src/components/containers/Panel.js renamed to src/components/containers/PlotlyPanel.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ PanelErrorImpl.propTypes = {
2626

2727
const PanelError = localize(PanelErrorImpl);
2828

29-
class Panel extends Component {
29+
class PlotlyPanel extends Component {
3030
constructor(props) {
3131
super(props);
3232
this.state = {
@@ -123,23 +123,29 @@ class Panel extends Component {
123123
}
124124
}
125125

126-
Panel.plotly_editor_traits = {no_visibility_forcing: true};
126+
PlotlyPanel.plotly_editor_traits = {no_visibility_forcing: true};
127127

128-
Panel.propTypes = {
128+
PlotlyPanel.propTypes = {
129129
children: PropTypes.node,
130130
addAction: PropTypes.object,
131131
showExpandCollapse: PropTypes.bool,
132132
noPadding: PropTypes.bool,
133133
};
134134

135-
Panel.defaultProps = {
135+
PlotlyPanel.defaultProps = {
136136
showExpandCollapse: true,
137137
};
138138

139-
Panel.contextTypes = {
139+
PlotlyPanel.contextTypes = {
140140
layout: PropTypes.object,
141141
onUpdate: PropTypes.func,
142142
updateContainer: PropTypes.func,
143143
};
144144

145-
export default Panel;
145+
export default PlotlyPanel;
146+
147+
export class Panel extends PlotlyPanel {}
148+
149+
Panel.plotly_editor_traits = {
150+
no_visibility_forcing: false,
151+
};

src/components/containers/Section.js renamed to src/components/containers/PlotlySection.js

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,28 @@ import {
55
localize,
66
unpackPlotProps,
77
} from '../../lib';
8-
import SectionHeader from './SectionHeader';
98

10-
class Section extends Component {
9+
export class Section extends Component {
10+
render() {
11+
return (
12+
<div className="section">
13+
<div className="section__heading">
14+
<div className="section__heading__text">{this.props.name}</div>
15+
</div>
16+
{this.props.children}
17+
</div>
18+
);
19+
}
20+
}
21+
22+
Section.plotly_editor_traits = {no_visibility_forcing: false};
23+
Section.propTypes = {
24+
children: PropTypes.node,
25+
name: PropTypes.string,
26+
attr: PropTypes.string,
27+
};
28+
29+
class PlotlySection extends Section {
1130
constructor(props, context) {
1231
super(props, context);
1332

@@ -52,20 +71,24 @@ class Section extends Component {
5271
}
5372
return (
5473
<div className="section">
55-
{this.props.name && <SectionHeader name={this.props.name} />}
74+
{this.props.name ? (
75+
<div className="section__heading">
76+
<div className="section__heading__text">{this.props.name}</div>
77+
</div>
78+
) : null}
5679
{this.props.children}
5780
</div>
5881
);
5982
}
6083
}
6184

62-
Section.plotly_editor_traits = {no_visibility_forcing: true};
85+
PlotlySection.plotly_editor_traits = {no_visibility_forcing: true};
6386

64-
Section.propTypes = {
87+
PlotlySection.propTypes = {
6588
children: PropTypes.node,
6689
name: PropTypes.string,
6790
attr: PropTypes.string,
6891
};
6992

70-
Section.contextTypes = containerConnectedContextTypes;
71-
export default localize(Section);
93+
PlotlySection.contextTypes = containerConnectedContextTypes;
94+
export default localize(PlotlySection);

src/components/containers/RangeSelectorAccordion.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Fold from './Fold';
2-
import Panel from './Panel';
1+
import PlotlyFold from './PlotlyFold';
2+
import PlotlyPanel from './PlotlyPanel';
33
import PropTypes from 'prop-types';
44
import React, {Component} from 'react';
55
import {connectRangeSelectorToAxis, localize} from 'lib';
66

7-
const RangeSelectorFold = connectRangeSelectorToAxis(Fold);
7+
const RangeSelectorFold = connectRangeSelectorToAxis(PlotlyFold);
88

99
class RangeSelectorAccordion extends Component {
1010
render() {
@@ -52,7 +52,11 @@ class RangeSelectorAccordion extends Component {
5252
},
5353
};
5454

55-
return <Panel addAction={addAction}>{content ? content : null}</Panel>;
55+
return (
56+
<PlotlyPanel addAction={addAction}>
57+
{content ? content : null}
58+
</PlotlyPanel>
59+
);
5660
}
5761
}
5862

src/components/containers/SectionHeader.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)