@carbon/ibm-products
Version:
Carbon for IBM Products
34 lines (28 loc) • 757 B
JavaScript
/**
* 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.
*/
;
var React = require('react');
/**
* -------------
* Context setup
* -------------
*/
const PageHeaderContext = /*#__PURE__*/React.createContext({
fullyCollapsed: false,
setRefs: () => {},
refs: {},
titleClipped: false
});
function usePageHeader() {
const context = React.useContext(PageHeaderContext);
if (!context) {
throw new Error('Page header context was not provided or hook was used outside of the Page header component.');
}
return context;
}
exports.PageHeaderContext = PageHeaderContext;
exports.usePageHeader = usePageHeader;