import * as React from "react"; import { Dispatch } from "redux"; import { BaseMediaQueryOptionsProps } from "./view.pc"; import { queryConditionChanged } from "../../../../../actions"; import { PCQuery, PCMediaQuery } from "paperclip"; import { EMPTY_OBJECT } from "tandem-common"; export type Props = { query: PCMediaQuery; dispatch: Dispatch; }; export default (Base: React.ComponentClass) => class MediaQueryOptionsController extends React.PureComponent { onMinWidthChange = (minWidth: string) => { this.props.dispatch( queryConditionChanged(this.props.query, { ...(this.props.query.condition || EMPTY_OBJECT), maxWidth: minWidth && Number(minWidth) }) ); }; onMaxWidthChange = (maxWidth: string) => { this.props.dispatch( queryConditionChanged(this.props.query, { ...(this.props.query.condition || EMPTY_OBJECT), maxWidth: maxWidth && Number(maxWidth) }) ); }; render() { const { onMinWidthChange, onMaxWidthChange } = this; const { query, ...rest } = this.props; return ( ); } };