@carbon/react
Version:
React components for the Carbon Design System
58 lines (56 loc) • 2.42 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.
*/
const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_usePrefix = require("../../internal/usePrefix.js");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let react_jsx_runtime = require("react/jsx-runtime");
let _carbon_icons_react = require("@carbon/icons-react");
//#region src/components/UIShell/SideNavFooter.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.
*/
/**
* SideNavFooter is used for rendering the button at the bottom of the side
* navigation that is a part of the UI Shell. It is responsible for handling the
* user interaction to expand or collapse the side navigation.
*/
function SideNavFooter({ assistiveText = "Toggle opening or closing the side navigation", className: customClassName, expanded, onToggle }) {
const prefix = require_usePrefix.usePrefix();
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
className: (0, classnames.default)(`${prefix}--side-nav__footer`, customClassName),
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
className: `${prefix}--side-nav__toggle`,
type: "button",
onClick: (evt) => onToggle(evt),
title: assistiveText,
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
className: `${prefix}--side-nav__icon`,
children: expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.Close, { size: 20 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.ChevronRight, { size: 20 })
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
className: `${prefix}--assistive-text`,
children: assistiveText
})]
})
});
}
SideNavFooter.displayName = "SideNavFooter";
SideNavFooter.propTypes = {
assistiveText: prop_types.default.string,
className: prop_types.default.string,
expanded: prop_types.default.bool.isRequired,
onToggle: prop_types.default.func.isRequired
};
//#endregion
exports.default = SideNavFooter;