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';
|
2017-10-19 15:08:15 -04:00
|
|
|
import ColorPicker from './color-picker/color-picker.jsx';
|
|
|
|
import ColorButton from './color-button/color-button.jsx';
|
2017-10-23 10:35:30 -04:00
|
|
|
import InputGroup from './input-group/input-group.jsx';
|
|
|
|
import Label from './forms/label.jsx';
|
2017-09-07 17:59:14 -04:00
|
|
|
|
|
|
|
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 => (
|
2017-10-26 17:33:33 -04:00
|
|
|
<InputGroup disabled={props.disabled}>
|
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
|
2017-10-26 18:09:27 -04:00
|
|
|
outline
|
2017-10-11 09:05:34 -04:00
|
|
|
color={props.strokeColor}
|
|
|
|
onClick={props.onOpenStrokeColor}
|
|
|
|
/>
|
|
|
|
</Label>
|
|
|
|
</Popover>
|
2017-10-23 10:35:30 -04:00
|
|
|
</InputGroup>
|
2017-09-07 17:59:14 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
StrokeColorIndicatorComponent.propTypes = {
|
2017-10-26 18:16:14 -04:00
|
|
|
disabled: PropTypes.bool.isRequired,
|
2017-09-07 17:59:14 -04:00
|
|
|
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);
|