package.src.components.Page.PageContext.tsx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react-core Show documentation
Show all versions of react-core Show documentation
This library provides a set of common React components for use with the PatternFly reference implementation.
The newest version!
import * as React from 'react';
import { getBreakpoint, getVerticalBreakpoint } from '../../helpers/util';
export interface PageContextProps {
isManagedSidebar: boolean;
onSidebarToggle: () => void;
isSidebarOpen: boolean;
width: number;
height: number;
getBreakpoint: (width: number | null) => 'default' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
getVerticalBreakpoint: (height: number | null) => 'default' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
}
export const pageContextDefaults: PageContextProps = {
isManagedSidebar: false,
isSidebarOpen: false,
onSidebarToggle: () => null,
width: null,
height: null,
getBreakpoint,
getVerticalBreakpoint
};
export const PageContext = React.createContext(pageContextDefaults);
export const PageContextProvider = PageContext.Provider;
export const PageContextConsumer = PageContext.Consumer;