-
-
Notifications
You must be signed in to change notification settings - Fork 112
Styles updates, Theming and other misc updates #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
4b4cebc
44dc991
8784cb4
e3c8125
8f63761
5366cec
7a90ba2
f732a3b
21b92d4
99326af
afc48ff
34d688c
877c2a0
1274aa7
fcea940
083232c
9bce0eb
4f36879
00f8ff6
0bf806d
fd1f37d
0f5a991
135bbf0
67cf1da
02a655b
9d91096
41a7942
e8b2b42
4742c0d
cfa1536
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,27 +13,21 @@ | |
"url": "https://github.com/plotly/react-plotly.js-editor/issues" | ||
}, | ||
"scripts": { | ||
"make:combined-translation-keys": | ||
"babel-node utils/findTranslationKeys.js && babel-node utils/combineTranslationKeys.js", | ||
"make:combined-translation-keys": "babel-node utils/findTranslationKeys.js && babel-node utils/combineTranslationKeys.js", | ||
"make:translation-keys": "babel-node utils/findTranslationKeys.js", | ||
"make:lib": | ||
"mkdirp lib && babel src --out-dir lib --ignore=__tests__/* --source-maps && npm run make:lib:css", | ||
"make:lib:css": | ||
"mkdirp lib && node-sass src/styles/main.scss > lib/react-plotly.js-editor.css", | ||
"make:dist": | ||
"mkdirp dist && browserify src/PlotlyEditor.js -o ./dist/PlotlyEditor.js -t [ babelify --presets [ es2015 react ] ] -t browserify-global-shim --standalone createPlotlyComponent && uglifyjs ./dist/PlotlyEditor.js --compress --mangle --output ./dist/PlotlyEditor.min.js --source-map filename=dist/PlotlyEditor.min.js.map && make:dist:css", | ||
"make:dist:css": | ||
"mkdirp dist && node-sass --output-style compressed src/styles/main.scss > dist/react-plotly.js-editor.css", | ||
"make:lib": "mkdirp lib && babel src --out-dir lib --ignore=__tests__/* --source-maps && npm run make:lib:css", | ||
"make:lib:css": "mkdirp lib && node-sass src/styles/main.scss > lib/react-plotly.js-editor.css", | ||
"make:dist": "mkdirp dist && browserify src/PlotlyEditor.js -o ./dist/PlotlyEditor.js -t [ babelify --presets [ es2015 react ] ] -t browserify-global-shim --standalone createPlotlyComponent && uglifyjs ./dist/PlotlyEditor.js --compress --mangle --output ./dist/PlotlyEditor.min.js --source-map filename=dist/PlotlyEditor.min.js.map && yarn make:dist:css", | ||
"make:dist:css": "mkdirp dist && node-sass src/styles/main.scss > dist/react-plotly.js-editor.css && yarn postcss", | ||
"prepublishOnly": "npm run make:lib", | ||
"lint": "prettier --write \"src/**/*.js\"", | ||
"test:lint": | ||
"eslint \"src/**/*.js\" && echo -e '\\033[0;32m'PASS'\\033[0m'", | ||
"test:pretty": | ||
"prettier -l \"src/**/*.js\" && echo -e '\\033[0;32m'PASS'\\033[0m'", | ||
"postcss": "babel-node src/postcss.js", | ||
"postcss:ie11": "NODE_ENV=ie babel-node src/postcss.js", | ||
"test:lint": "eslint \"src/**/*.js\" && echo -e '\\033[0;32m'PASS'\\033[0m'", | ||
"test:pretty": "prettier -l \"src/**/*.js\" && echo -e '\\033[0;32m'PASS'\\033[0m'", | ||
"test:js": "jest --setupTestFrameworkScriptFile=raf/polyfill", | ||
"test": "npm run test:lint && npm run test:pretty && npm run test:js", | ||
"watch": | ||
"babel src --watch --out-dir lib --source-maps | node-sass -w src/styles/main.scss lib/react-plotly.js-editor.css", | ||
"watch": "babel src --watch --out-dir lib --source-maps | node-sass -w src/styles/main.scss lib/react-plotly.js-editor.css", | ||
"watch-test": "jest --watch" | ||
}, | ||
"keywords": [ | ||
|
@@ -48,10 +42,13 @@ | |
"widgets" | ||
], | ||
"devDependencies": { | ||
"autoprefixer": "^7.2.3", | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-eslint": "^8.0.2", | ||
"babel-plugin-module-resolver": "^3.0.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-polyfill": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-2": "^6.24.1", | ||
|
@@ -65,11 +62,14 @@ | |
"eslint-config-prettier": "^2.7.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-react": "^7.4.0", | ||
"fs": "^0.0.1-security", | ||
"gl": "^4.0.4", | ||
"glob": "^7.1.2", | ||
"jest": "^21.2.1", | ||
"mkdirp": "^0.5.1", | ||
"node-sass": "^4.7.1", | ||
"node-sass": "^4.7.2", | ||
"postcss": "^6.0.14", | ||
"postcss-custom-properties": "^6.2.0", | ||
"prettier": "^1.9.2", | ||
"react-test-renderer": "^16.2.0", | ||
"uglify-js": "^3.0.26" | ||
|
@@ -79,14 +79,20 @@ | |
"react-dom": "^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0" | ||
}, | ||
"dependencies": { | ||
"babel-plugin-module-resolver": "^3.0.0", | ||
"browserify-global-shim": "^1.0.3", | ||
"cssnano": "^3.10.0", | ||
"draft-js": "^0.10.4", | ||
"draft-js-export-html": "github:plotly/draft-js-export-html", | ||
"draft-js-import-html": "^1.2.1", | ||
"draft-js-utils": "^1.2.0", | ||
"es6-shim": "^0.35.3", | ||
"fast-isnumeric": "^1.1.1", | ||
"mdi-react": "^2.1.19", | ||
"plotly-icons": "^1.0.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aulneau you're going to add the additional mdi-react icons we need to plotly-icons? |
||
"plotly.js": "^1.31.2", | ||
"postcss-combine-duplicated-selectors": "^3.1.4", | ||
"postcss-cssnext": "^3.0.2", | ||
"postcss-remove-root": "^0.0.2", | ||
"prop-types": "^15.5.10", | ||
"raf": "^3.4.0", | ||
"react": "^16.2.0", | ||
|
@@ -99,7 +105,9 @@ | |
"react": "React" | ||
}, | ||
"jest": { | ||
"roots": ["<rootDir>/src/"], | ||
"roots": [ | ||
"<rootDir>/src/" | ||
], | ||
"moduleNameMapper": { | ||
"^.+\\.css$": "<rootDir>/config/CSSStub.js" | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import PropTypes from 'prop-types'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Button should go in |
||
import React, {Component} from 'react'; | ||
import {bem} from 'lib'; | ||
|
||
class Button extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
const {variant, className, icon, label, children, ...rest} = this.props; | ||
|
||
let classes = `button`; | ||
|
||
if (variant) { | ||
classes += ` button--${variant}`; | ||
} else { | ||
classes += ` button--default`; | ||
} | ||
|
||
classes += ` ${className}`; | ||
|
||
const Icon = icon && <div className={bem('button', 'icon')}>{icon}</div>; | ||
|
||
return ( | ||
<button className={classes} {...rest}> | ||
<div className={bem('button', 'wrapper')}> | ||
{Icon} | ||
<div className="button__label">{label ? label : children}</div> | ||
</div> | ||
</button> | ||
); | ||
} | ||
} | ||
|
||
Button.propTypes = { | ||
variant: PropTypes.string, | ||
label: PropTypes.any, | ||
className: PropTypes.any, | ||
children: PropTypes.node, | ||
icon: PropTypes.any, | ||
}; | ||
|
||
export default Button; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types'; | |
import React, {Component} from 'react'; | ||
import {connectAnnotationToLayout, bem} from 'lib'; | ||
import {PanelHeader} from './Panel'; | ||
|
||
import Button from 'components/Button'; | ||
import PlusIcon from 'mdi-react/PlusIcon'; | ||
const AnnotationFold = connectAnnotationToLayout(Fold); | ||
|
||
export default class AnnotationAccordion extends Component { | ||
|
@@ -30,14 +31,18 @@ export default class AnnotationAccordion extends Component { | |
} | ||
|
||
render() { | ||
const annotations = this.context.layout.annotations || []; | ||
const {layout: {annotations = []}} = this.context; | ||
|
||
const {canAdd, children} = this.props; | ||
|
||
const addButton = canAdd && ( | ||
<button className="panel__add-button" onClick={this.addAnnotation}> | ||
+ Annotation | ||
</button> | ||
<Button | ||
variant="primary" | ||
className="js-add-annotation-button" | ||
onClick={this.addAnnotation} | ||
icon={<PlusIcon />} | ||
label="Annotation" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i18n |
||
/> | ||
); | ||
|
||
const panelHeader = canAdd && <PanelHeader action={addButton} />; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ import PropTypes from 'prop-types'; | |
import React, {Component} from 'react'; | ||
import {EDITOR_ACTIONS} from 'lib/constants'; | ||
import {connectTraceToPlot, bem} from 'lib'; | ||
import {PanelHeader} from 'components/containers/Panel'; | ||
import {PanelHeader, PanelEmpty} from 'components/containers/Panel'; | ||
import Button from 'components/Button'; | ||
import PlusIcon from 'mdi-react/PlusIcon'; | ||
|
||
const TraceFold = connectTraceToPlot(Fold); | ||
|
||
|
@@ -27,9 +29,13 @@ export default class TraceAccordion extends Component { | |
const {canAdd, children} = this.props; | ||
|
||
const addButton = canAdd && ( | ||
<button className="panel__add-button" onClick={this.addTrace}> | ||
+ Trace | ||
</button> | ||
<Button | ||
className="js-add-trace-button" | ||
variant="primary" | ||
onClick={this.addTrace} | ||
icon={<PlusIcon />} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or PlusIcon could be the default in the Button component? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or maybe not, if we're including modals to the editor (which I'm not sure we will be), maybe we want more flexibility on that button There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe... I think it might be better to leave no default icon, because there are buttons that don't have icons. |
||
label="Trace" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this needs to be wrapped in i18n |
||
/> | ||
); | ||
|
||
const panelHeader = canAdd && <PanelHeader action={addButton} />; | ||
|
@@ -40,8 +46,23 @@ export default class TraceAccordion extends Component { | |
</TraceFold> | ||
)); | ||
|
||
const emptyState = data.length && | ||
!data[0].x && | ||
!canAdd && ( | ||
<PanelEmpty | ||
heading="There aren't any traces." | ||
message={ | ||
<p> | ||
Looks like there are no traces selected yet, head back to the | ||
Create section to adjust the data. | ||
</p> | ||
} | ||
/> | ||
); | ||
|
||
return ( | ||
<div className={bem('panel', 'content')}> | ||
{emptyState} | ||
{panelHeader} | ||
{content} | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VeraZab I think you and @aulneau have squabbling .json formatting. I don't think we should use prettier on anything outside
/src
or at least not on anything other than *.js files.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sometimes my muscle memory causes me to autoformat anything after I hit save. But it's strange, my current package.json is formatted correctly: