@carbon/react
Version:
React components for the Carbon Design System
42 lines (40 loc) • 1.38 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 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 { usePrefix } from "../../internal/usePrefix.js";
import Link, { LinkPropTypes } from "./Link.js";
import classNames from "classnames";
import "react";
import PropTypes from "prop-types";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
//#region src/components/UIShell/HeaderName.tsx
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
function HeaderName({ children, className: customClassName, prefix = "IBM", ...rest }) {
const selectorPrefix = usePrefix();
const className = classNames(`${selectorPrefix}--header__name`, customClassName);
return /* @__PURE__ */ jsxs(Link, {
...rest,
className,
children: [prefix && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
className: `${selectorPrefix}--header__name--prefix`,
children: prefix
}), "\xA0"] }), /* @__PURE__ */ jsx("span", { children })]
});
}
HeaderName.propTypes = {
...LinkPropTypes,
children: PropTypes.node.isRequired,
className: PropTypes.string,
href: PropTypes.string,
prefix: PropTypes.string
};
//#endregion
export { HeaderName as default };