import * as React from "react";
import { ComputedStyleInfo } from "paperclip";
import { BaseRadiusInputProps } from "./borders.pc";
import { memoize } from "tandem-common";
import {
CornersIcon,
RoundSquareIcon
} from "../../../../../../../icons/view.pc";
export type Props = {
onPropertyChange: any;
onPropertyChangeComplete: any;
computedStyleInfo: ComputedStyleInfo;
};
const CONNECTED_ICON = (
);
const DISCONNECTED_ICON = (
);
export default (Base: React.ComponentClass) =>
class RadiusInputController extends React.PureComponent {
onPrimaryChange = (value: string) => {
this.props.onPropertyChange("border-top-left-radius", value);
this.props.onPropertyChange("border-top-right-radius", value);
this.props.onPropertyChange("border-bottom-left-radius", value);
this.props.onPropertyChange("border-bottom-right-radius", value);
};
onPrimaryChangeComplete = (value: string) => {
this.props.onPropertyChangeComplete("border-top-left-radius", value);
this.props.onPropertyChangeComplete("border-top-right-radius", value);
this.props.onPropertyChangeComplete("border-bottom-left-radius", value);
this.props.onPropertyChangeComplete("border-bottom-right-radius", value);
};
render() {
const { onPrimaryChange, onPrimaryChangeComplete } = this;
const {
computedStyleInfo,
onPropertyChange,
onPropertyChangeComplete,
...rest
} = this.props;
const connected =
computedStyleInfo.style["border-top-left-radius"] ===
computedStyleInfo.style["border-top-right-radius"] &&
computedStyleInfo.style["border-top-left-radius"] ===
computedStyleInfo.style["border-bottom-left-radius"] &&
computedStyleInfo.style["border-top-left-radius"] ===
computedStyleInfo.style["border-bottom-right-radius"];
return (
);
}
};
const propertyChangeCallback = memoize((name: string, listener) => value =>
listener(name, value)
);