-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Merged
Merged
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
4b4cebc
update styles for the sidebar, added chevron, more dynamic states
aulneau 44dc991
minor update to modal info styles
aulneau 8784cb4
start migrating over to custom-vars, added postcss step for ie11 that…
aulneau e3c8125
fixes to button styles when using standard html button
aulneau 8f63761
update from master
aulneau 5366cec
most variables now exist as css props
aulneau 7a90ba2
massive change to variables, almost everything (hopefully) is connect…
aulneau f732a3b
fix buttons for tests
aulneau 21b92d4
go through fold styles
aulneau 99326af
go through info and menu panel styles
aulneau afc48ff
update modalbox, radioblock, menupanel, section and field styles
aulneau 34d688c
update field styles, added FieldDelete element
aulneau 877c2a0
update color picker styles
aulneau 1274aa7
update sidebar styles, misc others
aulneau fcea940
update checkbox styles
aulneau 083232c
updates for theming, updated postcss settings
aulneau 9bce0eb
further theme tweaks
aulneau 4f36879
add empty state for no traces
aulneau 00f8ff6
add scripts, updated package.json with new scripts. IE css works.
aulneau 0bf806d
update scripts location, remove outdated style
aulneau fd1f37d
move button into widgets, added font-family to .plotly-editor
aulneau 0f5a991
remove relative 'lib', also small radiobutton css fix
aulneau 135bbf0
localize annotation and trace accordians
aulneau 67cf1da
fix changed path
aulneau 02a655b
added plotly fonts, added header style mixin, applied heading styles …
aulneau 9d91096
removed mdi-react dep, updated icons to plotly-icons
aulneau 41a7942
update styles scripts to generate sep stylesheets for ie and modern
aulneau e8b2b42
update README.md, added THEMING.md, clean up colors and added a coupl…
aulneau 4742c0d
fix prepublishOnly task, fixed DeprecationWarning in the styles scripts
aulneau cfa1536
Merge branch 'master' into further-design-updates
aulneau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
const fs = require('fs'); | ||
const postcss = require('postcss'); | ||
const customProperties = require('postcss-custom-properties'); | ||
const autoprefixer = require('autoprefixer'); | ||
const cssnano = require('cssnano'); | ||
const combineSelectors = require('postcss-combine-duplicated-selectors'); | ||
const removeRoot = require('postcss-remove-root'); | ||
|
||
/* eslint-disable no-process-env */ | ||
const SASS_ENV = process.env.SASS_ENV || 'default'; | ||
const BUILD_ENV = process.env.BUILD_ENV || 'lib'; | ||
|
||
const fileName = `react-plotly.js-editor`; | ||
const dist = `${BUILD_ENV}/${fileName}.css`; | ||
|
||
const internetExplorerPostCSS = () => { | ||
/** | ||
* IE11 specific post-processing | ||
* This will: | ||
* - combine duplicate selectors into one, | ||
* - convert all css variables into their true value | ||
* - remove unneeded `:root{}` after converting vars into their value | ||
* - autoprefix for IE11 | ||
* - minify the css with cssnano | ||
*/ | ||
const ie11_plugins = [ | ||
combineSelectors, | ||
customProperties, | ||
removeRoot, | ||
autoprefixer({browsers: ['ie 11']}), | ||
cssnano, | ||
]; | ||
fs.readFile(`${BUILD_ENV}/react-plotly.js-editor.css`, (err, css) => { | ||
postcss([...ie11_plugins]) | ||
.process(css, { | ||
from: dist, | ||
to: `${BUILD_ENV}/${fileName}.ie.min.css`, | ||
}) | ||
.then(result => { | ||
fs.writeFile(`${BUILD_ENV}/${fileName}.ie.min.css`, result.css); | ||
}); | ||
}); | ||
}; | ||
|
||
const defaultPostCSS = () => { | ||
/** | ||
* Default post-processing | ||
* This will: | ||
* - combine duplicate selectors into one, | ||
* - convert all css variables into their true value | ||
* - remove unneeded `:root{}` after converting vars into their value | ||
* - autoprefix for IE11 | ||
* - minify the css with cssnano | ||
*/ | ||
const default_plugins = [combineSelectors, autoprefixer, cssnano]; | ||
fs.readFile(`${BUILD_ENV}/${fileName}.css`, (err, css) => { | ||
postcss([...default_plugins]) | ||
.process(css, { | ||
from: `${BUILD_ENV}/${fileName}.css`, | ||
to: `${BUILD_ENV}/${fileName}.min.css`, | ||
}) | ||
.then(result => { | ||
fs.writeFile(`${BUILD_ENV}/${fileName}.min.css`, result.css); | ||
}); | ||
}); | ||
}; | ||
|
||
/** | ||
* Run our PostCSS scripts based off of SASS_ENV passed through | ||
*/ | ||
if (SASS_ENV === 'ie') { | ||
internetExplorerPostCSS(); | ||
} else { | ||
defaultPostCSS(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const sass = require('node-sass'); | ||
|
||
/* eslint-disable no-process-env */ | ||
const SASS_ENV = process.env.SASS_ENV || 'default'; | ||
const BUILD_ENV = process.env.BUILD_ENV || 'lib'; | ||
|
||
const src = 'src/styles/main.scss'; | ||
const fileName = `react-plotly.js-editor`; | ||
const dist = `${BUILD_ENV}/${fileName}.css`; | ||
|
||
/** | ||
* Compile our scss to css! | ||
* -- | ||
* the `data:...` line will inject our SASS_ENV value into our scss, | ||
* so we are able to do conditionals in scss for our env (default|ie) | ||
*/ | ||
fs.readFile(src, function(err, data) { | ||
sass.render( | ||
{ | ||
data: '$ENV: "' + SASS_ENV + '";\n' + data, | ||
includePaths: [path.dirname(src)], | ||
outFile: dist, | ||
}, | ||
(error, result) => { | ||
if (error) { | ||
/* eslint-disable no-console */ | ||
console.log(error.status); | ||
console.log(error.column); | ||
console.log(error.message); | ||
console.log(error.line); | ||
} else { | ||
fs.writeFile(dist, result.css); | ||
} | ||
} | ||
); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} />; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@aulneau you're going to add the additional mdi-react icons we need to plotly-icons?