import * as React from "react"; import { Dispatch } from "redux"; import { BaseSpacingPaneProps } from "./spacing.pc"; import { Side } from "./spacing-input-controller"; import { ComputedStyleInfo } from "paperclip"; import { memoize } from "tandem-common"; import { cssPropertyChanged, cssPropertyChangeCompleted } from "../../../../../../../actions"; import { DropdownMenuOption, dropdownMenuOptionFromValue } from "../../../../../../inputs/dropdown/controller"; export type Props = { dispatch: Dispatch; computedStyleInfo: ComputedStyleInfo; }; const BOX_SIZING_OPTIONS: DropdownMenuOption[] = [ undefined, "border-box", "content-box" ].map(dropdownMenuOptionFromValue); export default (Base: React.ComponentClass) => class SpacingPaneController extends React.PureComponent { render() { const { dispatch, computedStyleInfo, ...rest } = this.props; return ( ); } }; const sideChangeCallback = memoize( (dispatch: Dispatch, type: string) => (side: Side, value: string) => { dispatch(cssPropertyChanged(`${type}-${side}`, value)); } ); const propertyChangeCompleteCallback = memoize( (dispatch, name: string) => value => { dispatch(cssPropertyChangeCompleted(name, value)); } ); const sideChangeCompleteCallback = memoize( (dispatch: Dispatch, type: string) => (side: Side, value: string) => { dispatch(cssPropertyChangeCompleted(`${type}-${side}`, value)); } );