mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-23 14:02:50 -05:00
Fix linting
This commit is contained in:
parent
68c6f69211
commit
433baae5ba
7 changed files with 21 additions and 11 deletions
|
@ -8,8 +8,9 @@ import noFillIcon from './no-fill.svg';
|
||||||
import mixedFillIcon from './mixed-fill.svg';
|
import mixedFillIcon from './mixed-fill.svg';
|
||||||
import styles from './color-button.css';
|
import styles from './color-button.css';
|
||||||
|
|
||||||
const colorToBackground = (color) => {
|
const colorToBackground = color => {
|
||||||
return color === MIXED || color === null ? 'white' : color
|
if (color === MIXED || color === null) return 'white';
|
||||||
|
return color;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ColorButtonComponent = props => (
|
const ColorButtonComponent = props => (
|
||||||
|
@ -42,9 +43,9 @@ const ColorButtonComponent = props => (
|
||||||
);
|
);
|
||||||
|
|
||||||
ColorButtonComponent.propTypes = {
|
ColorButtonComponent.propTypes = {
|
||||||
outline: PropTypes.bool.isRequired,
|
|
||||||
color: PropTypes.string,
|
color: PropTypes.string,
|
||||||
onClick: PropTypes.func.isRequired
|
onClick: PropTypes.func.isRequired,
|
||||||
|
outline: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
ColorButtonComponent.defaultProps = {
|
ColorButtonComponent.defaultProps = {
|
||||||
|
|
|
@ -40,6 +40,7 @@ const FillColorIndicatorComponent = props => (
|
||||||
);
|
);
|
||||||
|
|
||||||
FillColorIndicatorComponent.propTypes = {
|
FillColorIndicatorComponent.propTypes = {
|
||||||
|
disabled: PropTypes.bool.isRequired,
|
||||||
fillColor: PropTypes.string,
|
fillColor: PropTypes.string,
|
||||||
fillColorModalVisible: PropTypes.bool.isRequired,
|
fillColorModalVisible: PropTypes.bool.isRequired,
|
||||||
intl: intlShape,
|
intl: intlShape,
|
||||||
|
|
|
@ -5,16 +5,19 @@ import PropTypes from 'prop-types';
|
||||||
import styles from './input-group.css';
|
import styles from './input-group.css';
|
||||||
|
|
||||||
const InputGroup = props => (
|
const InputGroup = props => (
|
||||||
<div className={classNames(props.className, styles.inputGroup, {
|
<div
|
||||||
[styles.disabled]: props.disabled
|
className={classNames(props.className, styles.inputGroup, {
|
||||||
})}>
|
[styles.disabled]: props.disabled
|
||||||
|
})}
|
||||||
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
InputGroup.propTypes = {
|
InputGroup.propTypes = {
|
||||||
children: PropTypes.node.isRequired,
|
children: PropTypes.node.isRequired,
|
||||||
className: PropTypes.string
|
className: PropTypes.string,
|
||||||
|
disabled: PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default InputGroup;
|
export default InputGroup;
|
||||||
|
|
|
@ -41,6 +41,7 @@ const StrokeColorIndicatorComponent = props => (
|
||||||
);
|
);
|
||||||
|
|
||||||
StrokeColorIndicatorComponent.propTypes = {
|
StrokeColorIndicatorComponent.propTypes = {
|
||||||
|
disabled: PropTypes.bool.isRequired,
|
||||||
intl: intlShape,
|
intl: intlShape,
|
||||||
onChangeStrokeColor: PropTypes.func.isRequired,
|
onChangeStrokeColor: PropTypes.func.isRequired,
|
||||||
onCloseStrokeColor: PropTypes.func.isRequired,
|
onCloseStrokeColor: PropTypes.func.isRequired,
|
||||||
|
|
|
@ -11,8 +11,8 @@ const BufferedInput = BufferedInputHOC(Input);
|
||||||
const StrokeWidthIndicatorComponent = props => (
|
const StrokeWidthIndicatorComponent = props => (
|
||||||
<InputGroup disabled={props.disabled}>
|
<InputGroup disabled={props.disabled}>
|
||||||
<BufferedInput
|
<BufferedInput
|
||||||
disabled={props.disabled}
|
|
||||||
small
|
small
|
||||||
|
disabled={props.disabled}
|
||||||
max={MAX_STROKE_WIDTH}
|
max={MAX_STROKE_WIDTH}
|
||||||
min="0"
|
min="0"
|
||||||
type="number"
|
type="number"
|
||||||
|
@ -23,6 +23,7 @@ const StrokeWidthIndicatorComponent = props => (
|
||||||
);
|
);
|
||||||
|
|
||||||
StrokeWidthIndicatorComponent.propTypes = {
|
StrokeWidthIndicatorComponent.propTypes = {
|
||||||
|
disabled: PropTypes.bool.isRequired,
|
||||||
onChangeStrokeWidth: PropTypes.func.isRequired,
|
onChangeStrokeWidth: PropTypes.func.isRequired,
|
||||||
strokeWidth: PropTypes.number
|
strokeWidth: PropTypes.number
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,6 @@ class LineMode extends React.Component {
|
||||||
this.props.onChangeStrokeColor(LineMode.DEFAULT_COLOR);
|
this.props.onChangeStrokeColor(LineMode.DEFAULT_COLOR);
|
||||||
}
|
}
|
||||||
// Force a minimum stroke width
|
// Force a minimum stroke width
|
||||||
console.log(this.props.colorState.strokeWidth)
|
|
||||||
if (!this.props.colorState.strokeWidth) {
|
if (!this.props.colorState.strokeWidth) {
|
||||||
this.props.onChangeStrokeWidth(1);
|
this.props.onChangeStrokeWidth(1);
|
||||||
}
|
}
|
||||||
|
@ -237,6 +236,8 @@ LineMode.propTypes = {
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
handleMouseDown: PropTypes.func.isRequired,
|
handleMouseDown: PropTypes.func.isRequired,
|
||||||
isLineModeActive: PropTypes.bool.isRequired,
|
isLineModeActive: PropTypes.bool.isRequired,
|
||||||
|
onChangeStrokeColor: PropTypes.func.isRequired,
|
||||||
|
onChangeStrokeWidth: PropTypes.func.isRequired,
|
||||||
onUpdateSvg: PropTypes.func.isRequired
|
onUpdateSvg: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class PenMode extends React.Component {
|
||||||
// Force the default pen color if stroke is MIXED or transparent
|
// Force the default pen color if stroke is MIXED or transparent
|
||||||
const {strokeColor} = this.props.colorState;
|
const {strokeColor} = this.props.colorState;
|
||||||
if (strokeColor === MIXED || strokeColor === null) {
|
if (strokeColor === MIXED || strokeColor === null) {
|
||||||
this.props.onChangeStrokeColor(PenMode.DEFAULT_COLOR)
|
this.props.onChangeStrokeColor(PenMode.DEFAULT_COLOR);
|
||||||
}
|
}
|
||||||
// Force a minimum stroke width
|
// Force a minimum stroke width
|
||||||
if (!this.props.colorState.strokeWidth) {
|
if (!this.props.colorState.strokeWidth) {
|
||||||
|
@ -88,6 +88,8 @@ PenMode.propTypes = {
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
handleMouseDown: PropTypes.func.isRequired,
|
handleMouseDown: PropTypes.func.isRequired,
|
||||||
isPenModeActive: PropTypes.bool.isRequired,
|
isPenModeActive: PropTypes.bool.isRequired,
|
||||||
|
onChangeStrokeColor: PropTypes.func.isRequired,
|
||||||
|
onChangeStrokeWidth: PropTypes.func.isRequired,
|
||||||
onUpdateSvg: PropTypes.func.isRequired
|
onUpdateSvg: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue