UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

74 lines (66 loc) 2.52 kB
/** * Copyright IBM Corp. 2020, 2025 * * 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 { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js'; import React__default from 'react'; import PropTypes from '../../_virtual/index.js'; import cx from 'classnames'; import { getDevtoolsProps } from '../../global/js/utils/devtools.js'; import { pkg } from '../../settings.js'; // The block part of our conventional BEM class names (blockClass__E--M). const blockClass = `${pkg.prefix}--guidebanner__element`; const componentName = 'GuidebannerElement'; /** * The GuidebannerElement is a required child component of the Guidebanner, * and acts as a container for a CarouselItem. */ let GuidebannerElement = /*#__PURE__*/React__default.forwardRef((_ref, ref) => { let { button, className, description, title, ...rest } = _ref; return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, { className: cx(blockClass, className), ref: ref }, getDevtoolsProps(componentName)), title && /*#__PURE__*/React__default.createElement("h2", { className: `${blockClass}-title` }, title), description && /*#__PURE__*/React__default.createElement("p", { className: `${blockClass}-content` }, description), button && /*#__PURE__*/React__default.createElement("div", { className: `${blockClass}-buttons` }, button)); }); // Return a placeholder if not released and not enabled by feature flag GuidebannerElement = pkg.checkComponentEnabled(GuidebannerElement, componentName); // The display name of the component, used by React. Note that displayName // is used in preference to relying on function.name. GuidebannerElement.displayName = componentName; // The types and DocGen commentary for the component props, // in alphabetical order (for consistency). // See https://www.npmjs.com/package/prop-types#usage. GuidebannerElement.propTypes = { /** * An optional button can be rendered below the description. * This can be a link, button, Coachmark button, etc. */ button: PropTypes.node, /** * Provide an optional class to be applied to the containing node. */ className: PropTypes.string, /** * The description of the element. */ description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired, /** * The title of the element. */ title: PropTypes.string }; export { GuidebannerElement };