import * as React from "react"; import * as cx from "classnames"; import { BaseBoxShadowItemProps } from "./box-shadow.pc"; import { PCVariable } from "paperclip"; import { getPrettyPaneColorSwatchOptionGroups } from "./utils"; export type BoxShadowInfo = { inset: boolean; color: string; x: string; y: string; blur: string; spread: string; }; export type Props = { onRemove: any; selected: boolean; documentColors: string[]; value: BoxShadowInfo; onChange: any; onChangeComplete: any; onBackgroundClick: any; globalVariables: PCVariable[]; }; export default (Base: React.ComponentClass) => class BoxShadowItemController extends React.PureComponent { onColorChange = color => { const { value, onChange } = this.props; onChange({ ...value, color }); }; onColorChangeComplete = color => { const { value, onChangeComplete } = this.props; onChangeComplete({ ...value, color }); }; onXChange = x => { const { value, onChange } = this.props; onChange({ ...value, x }); }; onXChangeComplete = x => { const { value, onChangeComplete } = this.props; onChangeComplete({ ...value, x }); }; onYChange = y => { const { value, onChange } = this.props; onChange({ ...value, y }); }; onYChangeComplete = y => { const { value, onChangeComplete } = this.props; onChangeComplete({ ...value, y }); }; onBlurChange = blur => { const { value, onChange } = this.props; onChange({ ...value, blur }); }; onBlurChangeComplete = blur => { const { value, onChangeComplete } = this.props; onChangeComplete({ ...value, blur }); }; onSpreadChange = spread => { const { value, onChange } = this.props; onChange({ ...value, spread }); }; onSpreadChangeComplete = spread => { const { value, onChangeComplete } = this.props; onChangeComplete({ ...value, spread }); }; render() { const { value: { color, x, y, blur, spread }, selected, documentColors, onChange, onChangeComplete, onBackgroundClick, globalVariables, onRemove, ...rest } = this.props; const { onColorChange, onColorChangeComplete, onXChange, onXChangeComplete, onYChange, onYChangeComplete, onBlurChange, onBlurChangeComplete, onSpreadChange, onSpreadChangeComplete } = this; return ( ); } }; const stopPropagation = event => event.stopPropagation();