2017-09-07 17:59:14 -04:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-10-11 09:05:34 -04:00
|
|
|
import Popover from 'react-popover';
|
2017-09-07 17:59:14 -04:00
|
|
|
|
|
|
|
import {defineMessages, injectIntl, intlShape} from 'react-intl';
|
|
|
|
import Label from './forms/label.jsx';
|
2017-10-11 09:05:34 -04:00
|
|
|
import ColorPicker from './color-picker.jsx';
|
|
|
|
import ColorButton from './color-button.jsx';
|
2017-10-02 15:25:04 -04:00
|
|
|
|
2017-09-07 17:59:14 -04:00
|
|
|
import styles from './paint-editor.css';
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
stroke: {
|
|
|
|
id: 'paint.paintEditor.stroke',
|
|
|
|
description: 'Label for the color picker for the outline color',
|
|
|
|
defaultMessage: 'Outline'
|
|
|
|
}
|
|
|
|
});
|
2017-10-11 09:05:34 -04:00
|
|
|
|
2017-09-07 17:59:14 -04:00
|
|
|
const StrokeColorIndicatorComponent = props => (
|
|
|
|
<div className={styles.inputGroup}>
|
2017-10-11 09:05:34 -04:00
|
|
|
<Popover
|
|
|
|
body={
|
|
|
|
<ColorPicker
|
|
|
|
color={props.strokeColor}
|
|
|
|
onChangeColor={props.onChangeStrokeColor}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
isOpen={props.strokeColorModalVisible}
|
|
|
|
preferPlace="below"
|
|
|
|
onOuterAction={props.onCloseStrokeColor}
|
|
|
|
>
|
|
|
|
<Label text={props.intl.formatMessage(messages.stroke)}>
|
|
|
|
<ColorButton
|
|
|
|
color={props.strokeColor}
|
|
|
|
onClick={props.onOpenStrokeColor}
|
|
|
|
/>
|
|
|
|
</Label>
|
|
|
|
</Popover>
|
2017-09-07 17:59:14 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
StrokeColorIndicatorComponent.propTypes = {
|
|
|
|
intl: intlShape,
|
|
|
|
onChangeStrokeColor: PropTypes.func.isRequired,
|
2017-10-11 09:05:34 -04:00
|
|
|
onCloseStrokeColor: PropTypes.func.isRequired,
|
|
|
|
onOpenStrokeColor: PropTypes.func.isRequired,
|
|
|
|
strokeColor: PropTypes.string,
|
|
|
|
strokeColorModalVisible: PropTypes.bool.isRequired
|
2017-09-07 17:59:14 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export default injectIntl(StrokeColorIndicatorComponent);
|