diff --git a/src/components/color-button/color-button.css b/src/components/color-button/color-button.css index 1fd2e0c0..5ef6744d 100644 --- a/src/components/color-button/color-button.css +++ b/src/components/color-button/color-button.css @@ -5,6 +5,7 @@ } .color-button-swatch { + position: relative; display: flex; flex-basis: 2rem; flex-shrink: 0; @@ -30,3 +31,23 @@ color: #575e75; font-size: 0.75rem; } + +.swatch-icon { + width: 1.75rem; + margin: auto; + /* Make sure it appears above the outline box */ + z-index: 2; +} + +.outline-swatch:after { + content: ""; + position: absolute; + top: calc(0.5rem + 1px); + left: calc(0.5rem + 1px); + width: 0.75rem; + height: 0.75rem; + background: white; + border: 1px solid rgba(0, 0, 0, 0.25); + /* Make sure it appears below the transparent icon */ + z-index: 1; +} diff --git a/src/components/color-button/color-button.jsx b/src/components/color-button/color-button.jsx index 9a7087e5..067a8ee5 100644 --- a/src/components/color-button/color-button.jsx +++ b/src/components/color-button/color-button.jsx @@ -1,26 +1,55 @@ import React from 'react'; import PropTypes from 'prop-types'; +import classNames from 'classnames'; +import {MIXED} from '../../helper/style-path'; + +import noFillIcon from './no-fill.svg'; +import mixedFillIcon from './mixed-fill.svg'; import styles from './color-button.css'; +const colorToBackground = color => { + if (color === MIXED || color === null) return 'white'; + return color; +}; + const ColorButtonComponent = props => (
+ > + {props.color === null ? ( + + ) : ((props.color === MIXED ? ( + + ) : null))} +
); ColorButtonComponent.propTypes = { color: PropTypes.string, - onClick: PropTypes.func.isRequired + onClick: PropTypes.func.isRequired, + outline: PropTypes.bool.isRequired +}; + +ColorButtonComponent.defaultProps = { + outline: false }; export default ColorButtonComponent; diff --git a/src/components/color-button/mixed-fill.svg b/src/components/color-button/mixed-fill.svg new file mode 100644 index 00000000..7a4fbcde --- /dev/null +++ b/src/components/color-button/mixed-fill.svg @@ -0,0 +1,16 @@ + + + + mixed-fill + Created with Sketch. + + + + + + + + + + + diff --git a/src/components/color-button/no-fill.svg b/src/components/color-button/no-fill.svg new file mode 100644 index 00000000..d955dda1 --- /dev/null +++ b/src/components/color-button/no-fill.svg @@ -0,0 +1,12 @@ + + + + no-fill + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/src/components/color-picker/color-picker.css b/src/components/color-picker/color-picker.css index 5ef9b537..3a796cff 100644 --- a/src/components/color-picker/color-picker.css +++ b/src/components/color-picker/color-picker.css @@ -48,3 +48,7 @@ border: 1px solid #4C97FF; box-shadow: 0px 0px 0px 3px hsla(215, 100%, 65%, 0.2); } + +.swatch > img { + max-width: 100%; +} diff --git a/src/components/color-picker/color-picker.jsx b/src/components/color-picker/color-picker.jsx index ab54a986..1317a510 100644 --- a/src/components/color-picker/color-picker.jsx +++ b/src/components/color-picker/color-picker.jsx @@ -9,6 +9,7 @@ import {MIXED} from '../../helper/style-path'; import Slider from '../forms/slider.jsx'; import styles from './color-picker.css'; +import noFillIcon from '../color-button/no-fill.svg'; const colorStringToHsv = hexString => { const hsv = parseColor(hexString).hsv; @@ -179,7 +180,9 @@ class ColorPickerComponent extends React.Component { [styles.activeSwatch]: this.props.color === null })} onClick={this.handleTransparent} - /> + > + + diff --git a/src/components/fill-color-indicator.jsx b/src/components/fill-color-indicator.jsx index 1e696ea5..4e49c145 100644 --- a/src/components/fill-color-indicator.jsx +++ b/src/components/fill-color-indicator.jsx @@ -17,7 +17,7 @@ const messages = defineMessages({ }); const FillColorIndicatorComponent = props => ( - + ( ); FillColorIndicatorComponent.propTypes = { + disabled: PropTypes.bool.isRequired, fillColor: PropTypes.string, fillColorModalVisible: PropTypes.bool.isRequired, intl: intlShape, diff --git a/src/components/input-group/input-group.css b/src/components/input-group/input-group.css index 80fdba7a..66905a2a 100644 --- a/src/components/input-group/input-group.css +++ b/src/components/input-group/input-group.css @@ -3,3 +3,9 @@ .input-group + .input-group { margin-left: calc(3 * $grid-unit); } + +.disabled { + opacity: 0.3; + /* Prevent any user actions */ + pointer-events: none; +} diff --git a/src/components/input-group/input-group.jsx b/src/components/input-group/input-group.jsx index 423dc5e7..db009ed3 100644 --- a/src/components/input-group/input-group.jsx +++ b/src/components/input-group/input-group.jsx @@ -5,14 +5,19 @@ import PropTypes from 'prop-types'; import styles from './input-group.css'; const InputGroup = props => ( -
+
{props.children}
); InputGroup.propTypes = { children: PropTypes.node.isRequired, - className: PropTypes.string + className: PropTypes.string, + disabled: PropTypes.bool }; export default InputGroup; diff --git a/src/components/stroke-color-indicator.jsx b/src/components/stroke-color-indicator.jsx index 5a3cfae0..5759ddba 100644 --- a/src/components/stroke-color-indicator.jsx +++ b/src/components/stroke-color-indicator.jsx @@ -17,7 +17,7 @@ const messages = defineMessages({ }); const StrokeColorIndicatorComponent = props => ( - + ( >