import * as React from "react"; import * as cx from "classnames"; import { memoize } from "tandem-common"; import { ButtonBarOption } from "../../../../../../inputs/button-bar/controller"; import { BaseBorderStylesProps } from "./borders.pc"; import { PCVariable, ComputedStyleInfo } from "paperclip"; const { EmptySquareIcon, BordersIcon3 } = require("../../../../../../../icons/view.pc"); enum TOGGLE_OPTION { ALL, INDIVIDUAL } const TOGGLE_OPTIONS: ButtonBarOption[] = [ { icon: , value: TOGGLE_OPTION.ALL }, { icon: , value: TOGGLE_OPTION.INDIVIDUAL } ]; export type Props = { globalVariables: PCVariable[]; documentColors: string[]; onPropertyChange: any; onPropertyChangeComplete: any; computedStyleInfo: ComputedStyleInfo; }; type State = { borderStyling: TOGGLE_OPTION; }; export default (Base: React.ComponentClass) => class BorderStylesController extends React.PureComponent { constructor(props) { super(props); const { computedStyleInfo } = props; this.state = { borderStyling: computedStyleInfo.style["border-left"] || computedStyleInfo.style["border-right"] || computedStyleInfo.style["border-top"] || computedStyleInfo.style["border-bottom"] ? TOGGLE_OPTION.INDIVIDUAL : TOGGLE_OPTION.ALL }; } setBorderStyling = (value: TOGGLE_OPTION) => { this.setState({ ...this.state, borderStyling: value }); }; onStyleToggleChangeComplete = value => { this.setBorderStyling(value); }; render() { const { documentColors, onPropertyChange, onPropertyChangeComplete, computedStyleInfo, globalVariables, ...rest } = this.props; const { borderStyling } = this.state; const { onStyleToggleChangeComplete } = this; return ( ); } }; const propertyChangeCallback = memoize((name: string, listener) => value => listener(name, value) );