все же в контейнерах ?
class ColorPopover extends Component {
constructor() {
super();
ColorPicker = component('components/color');
}
onApply = () => {
this.refs.popover.getWrappedInstance().hidePopover();
this.props.onChange(this.props.value);
};
onCancel = () => {
const { onChange } = this.props;
onChange(this.initialColor);
this.refs.popover.getWrappedInstance().hidePopover();
};
render() {
const {
innerRef,
value,
onChange,
onMove,
width,
height,
popoverOptions
} = this.props;
return (
<Popover
ref="popover"
target={({ openPopover }) => (
<ColorButton
color={value}
onClick={() => {
this.initialColor = value;
openPopover();
}}
/>
)}
onOutSideClick={() => {
onChange(this.initialColor);
}}
height={height}
width={width}
{...popoverOptions}
>
<div className="toolbar__popover_color" ref={innerRef}>
<ColorPicker
dynamic={{ tempColor: value }}
emit={{ onChange: onChange, onMove: onMove }}
/>
<div className="tb_bt flex">
<Button
className="form__builder-btn flex_1"
onClick={this.onApply}
text="Apply"
/>
<Button
className="form__builder-btn flex_1"
onClick={this.onCancel}
text="Cancel"
/>
</div>
</div>
</Popover>
);
}
}
Лучше на гист кидай.
Обсуждают сегодня