UNPKG

@patternplate/client

Version:

Universal javascript client application for patternplate

42 lines (36 loc) 827 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.type = exports.default = void 0; var _ = require("./"); var _default = searchPreview; exports.default = _default; const type = "SEARCH_PREVIEW"; exports.type = type; const MOVEMENTS = { up: -1, down: 1 }; function searchPreview(payload) { if (typeof payload === "number") { return dispatch => { dispatch((0, _.patchLocation)({ query: { "search-preview": payload } })); }; } return (dispatch, getState) => { const state = getState(); const delta = MOVEMENTS[payload] || 0; dispatch((0, _.patchLocation)({ query: { "search-preview": state.searchPreview + delta } })); }; } searchPreview.type = type; //# sourceMappingURL=search-preview.js.map