choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
30 lines (26 loc) • 1.13 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React, { memo, useCallback } from 'react';
import classNames from 'classnames';
import Icon from '../icon';
var ExpandIcon = function ExpandIcon(props) {
var _classNames;
var prefixCls = props.prefixCls,
expanded = props.expanded,
expandable = props.expandable,
onChange = props.onChange;
var iconPrefixCls = "".concat(prefixCls, "-expand-icon");
var classString = classNames(iconPrefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(iconPrefixCls, "-expanded"), expanded), _defineProperty(_classNames, "".concat(iconPrefixCls, "-spaced"), !expandable), _classNames));
var handleClick = useCallback(function (e) {
e.stopPropagation();
onChange(e);
}, [onChange]);
return /*#__PURE__*/React.createElement(Icon, {
type: "baseline-arrow_right",
className: classString,
onClick: expandable ? handleClick : undefined,
tabIndex: expandable ? 0 : -1
});
};
ExpandIcon.displayName = 'ExpandIcon';
export default /*#__PURE__*/memo(ExpandIcon);
//# sourceMappingURL=ExpandIcon.js.map