import * as React from "react"; import { cssPropertyChangeCompleted, cssPropertyChanged } from "../../../../../../../actions"; import { memoize } from "tandem-common"; import { SyntheticElement, PCVariable, PCSourceTagNames, isTextLikePCNode, ComputedStyleInfo } from "paperclip"; import { Dispatch } from "redux"; import { BaseBorderProps } from "./borders.pc"; export type Props = { globalVariables: PCVariable[]; documentColors: string[]; dispatch: Dispatch; computedStyleInfo: ComputedStyleInfo; }; export default (Base: React.ComponentClass) => class BordersController extends React.PureComponent { onPropertyChange = (name, value) => { this.props.dispatch(cssPropertyChanged(name, value)); }; onPropertyChangeComplete = (name, value) => { this.props.dispatch(cssPropertyChangeCompleted(name, value)); }; render() { const { computedStyleInfo, documentColors, globalVariables } = this.props; const { onPropertyChange, onPropertyChangeComplete } = this; const { sourceNode } = computedStyleInfo; // Typography pane is only available to text nodes to prevent cascading styles if (isTextLikePCNode(sourceNode)) { return null; } if (!computedStyleInfo) { return null; } return ( ); } }; const propertyChangeCallback = memoize((name: string, listener) => value => listener(name, value) );