wix-style-react
Version:
43 lines (41 loc) • 1.36 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { st, classes } from './Affix.st.css';
import InputConsumer from '../InputConsumer';
import { FontUpgradeContext } from '../../FontUpgrade/context';
var Affix = function Affix(_ref) {
var children = _ref.children,
value = _ref.value;
return /*#__PURE__*/React.createElement(InputConsumer, {
consumerCompName: Affix.displayName
}, function (_ref2) {
var size = _ref2.size,
inPrefix = _ref2.inPrefix,
inSuffix = _ref2.inSuffix,
border = _ref2.border,
roundInput = _ref2.roundInput,
disabled = _ref2.disabled,
onInputClicked = _ref2.onInputClicked;
return /*#__PURE__*/React.createElement(FontUpgradeContext.Consumer, null, function (_ref3) {
var isMadefor = _ref3.active;
return /*#__PURE__*/React.createElement("div", {
className: st(classes.root, {
isMadefor: isMadefor,
size: size,
inPrefix: inPrefix,
inSuffix: inSuffix,
border: roundInput ? 'round' : border,
disabled: disabled
}),
onClick: onInputClicked,
"data-hook": "custom-affix"
}, value || children);
});
});
};
Affix.displayName = 'Input.Affix';
Affix.propTypes = {
children: PropTypes.node,
value: PropTypes.string
};
export default Affix;