UNPKG

instantsearch-ui-components

Version:

Common UI components for InstantSearch.

22 lines 1.12 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["variant", "size", "iconOnly", "className", "children"]; import { cx } from "../lib/cx.js"; export function createButtonComponent(_ref) { var createElement = _ref.createElement; return function Button(userProps) { var _userProps$variant = userProps.variant, variant = _userProps$variant === void 0 ? 'primary' : _userProps$variant, _userProps$size = userProps.size, size = _userProps$size === void 0 ? 'md' : _userProps$size, _userProps$iconOnly = userProps.iconOnly, iconOnly = _userProps$iconOnly === void 0 ? false : _userProps$iconOnly, className = userProps.className, children = userProps.children, props = _objectWithoutProperties(userProps, _excluded); return createElement("button", _extends({ type: "button", className: cx('ais-Button', "ais-Button--".concat(variant), "ais-Button--".concat(size), iconOnly && 'ais-Button--icon-only', className) }, props), children); }; }