@carbon/ibm-products
Version:
Carbon for IBM Products
58 lines (56 loc) • 2.2 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 2026
*
* 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 { __toESM } from "../../_virtual/_rolldown/runtime.js";
import { require_classnames } from "../../node_modules/classnames/index.js";
import { pkg } from "../../settings.js";
import { getDevtoolsProps } from "../../global/js/utils/devtools.js";
import React from "react";
import PropTypes from "prop-types";
//#region src/components/Guidebanner/GuidebannerElement.tsx
/**
* Copyright IBM Corp. 2023, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
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.
*/
const GuidebannerElement = React.forwardRef(({ button, className, description, title, ...rest }, ref) => {
return /* @__PURE__ */ React.createElement("div", {
...rest,
className: (0, import_classnames.default)(blockClass, className),
ref,
...getDevtoolsProps(componentName)
}, title && /* @__PURE__ */ React.createElement("h2", { className: `${blockClass}-title` }, title), description && /* @__PURE__ */ React.createElement("p", { className: `${blockClass}-content` }, description), button && /* @__PURE__ */ React.createElement("div", { className: `${blockClass}-buttons` }, button));
});
GuidebannerElement.displayName = componentName;
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
};
//#endregion
export { GuidebannerElement };