@carbon/ibm-cloud-cognitive-cdai
Version:
Carbon for Cloud & Cognitive CD&AI UI components
35 lines (34 loc) • 1.27 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "className", "iconAnimation"];
//
// Copyright IBM Corp. 2020, 2020
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'carbon-components-react';
import { idePrefix } from '../../globals/js/settings';
var IdeButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var children = _ref.children,
className = _ref.className,
iconAnimation = _ref.iconAnimation,
otherProps = _objectWithoutProperties(_ref, _excluded);
var buttonClasses = iconAnimation === 'rotate-180-anti' ? "".concat(idePrefix, "-btn--rotate-180-anti") : '';
if (className) {
buttonClasses += ' ' + className;
}
return /*#__PURE__*/React.createElement(Button, _extends({
ref: ref,
className: buttonClasses
}, otherProps), children);
});
IdeButton.displayName = 'IdeButton';
IdeButton.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
iconAnimation: PropTypes.string
};
export default IdeButton;