package.src.components.Toolbar.ToolbarUtils.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 { RefObject } from 'react';
import globalBreakpointMd from '@patternfly/react-tokens/dist/esm/global_breakpoint_md';
import globalBreakpointLg from '@patternfly/react-tokens/dist/esm/global_breakpoint_lg';
import globalBreakpointXl from '@patternfly/react-tokens/dist/esm/global_breakpoint_xl';
import globalBreakpoint2xl from '@patternfly/react-tokens/dist/esm/global_breakpoint_2xl';
export interface ToolbarContextProps {
isExpanded: boolean;
toggleIsExpanded: () => void;
chipGroupContentRef: RefObject;
updateNumberFilters: (categoryName: string, numberOfFilters: number) => void;
numberOfFilters: number;
clearAllFilters?: () => void;
clearFiltersButtonText?: string;
showClearFiltersButton?: boolean;
toolbarId?: string;
customChipGroupContent?: React.ReactNode;
}
export const ToolbarContext = React.createContext({
isExpanded: false,
toggleIsExpanded: () => {},
chipGroupContentRef: null,
updateNumberFilters: () => {},
numberOfFilters: 0,
clearAllFilters: () => {}
});
interface ToolbarContentContextProps {
expandableContentRef: RefObject;
expandableContentId: string;
chipContainerRef: RefObject;
isExpanded?: boolean;
clearAllFilters?: () => void;
clearFiltersButtonText?: string;
showClearFiltersButton?: boolean;
}
export const ToolbarContentContext = React.createContext({
expandableContentRef: null,
expandableContentId: '',
chipContainerRef: null,
clearAllFilters: () => {}
});
export const globalBreakpoints = {
md: parseInt(globalBreakpointMd.value),
lg: parseInt(globalBreakpointLg.value),
xl: parseInt(globalBreakpointXl.value),
'2xl': parseInt(globalBreakpoint2xl.value)
};