UNPKG

@carbon/ibm-products

Version:
36 lines (34 loc) 1.04 kB
/** * 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 { createContext, useContext } from "react"; //#region src/components/PageHeader/next/context.ts /** * Copyright IBM Corp. 2025, 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. */ const PageHeaderContext = createContext({ setRefs: () => {}, refs: {}, pageActionsInstance: null, setPageActionsInstance: () => {}, observerState: { fullyCollapsed: false, titleClipped: false, contentActionsClipped: false }, disableStickyTabBar: false, setDisableStickyTabBar: () => {} }); function usePageHeader() { const context = 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; } //#endregion export { PageHeaderContext, usePageHeader };