-
Notifications
You must be signed in to change notification settings - Fork 382
Expand file tree
/
Copy pathToolbarUtils.tsx
More file actions
62 lines (56 loc) · 2.05 KB
/
ToolbarUtils.tsx
File metadata and controls
62 lines (56 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { createContext, RefObject } from 'react';
import globalBreakpointMd from '@patternfly/react-tokens/dist/esm/t_global_breakpoint_md';
import globalBreakpointLg from '@patternfly/react-tokens/dist/esm/t_global_breakpoint_lg';
import globalBreakpointXl from '@patternfly/react-tokens/dist/esm/t_global_breakpoint_xl';
import globalBreakpoint2xl from '@patternfly/react-tokens/dist/esm/t_global_breakpoint_2xl';
export interface ToolbarContextProps {
isExpanded: boolean;
toggleIsExpanded: () => void;
labelGroupContentRef: RefObject<HTMLDivElement | null>;
updateNumberFilters: (categoryName: string, numberOfFilters: number) => void;
numberOfFilters: number;
clearAllFilters?: () => void;
clearFiltersButtonText?: string;
showClearFiltersButton?: boolean;
toolbarId?: string;
customLabelGroupContent?: React.ReactNode;
useContainerQuery?: boolean;
}
export const ToolbarContext = createContext<ToolbarContextProps>({
isExpanded: false,
toggleIsExpanded: () => {},
labelGroupContentRef: null,
updateNumberFilters: () => {},
numberOfFilters: 0,
clearAllFilters: () => {},
useContainerQuery: false
});
interface ToolbarContentContextProps {
expandableContentRef: RefObject<HTMLDivElement | null>;
expandableContentId: string;
labelContainerRef: RefObject<any>;
isExpanded?: boolean;
clearAllFilters?: () => void;
clearFiltersButtonText?: string;
showClearFiltersButton?: boolean;
}
export const ToolbarContentContext = createContext<ToolbarContentContextProps>({
expandableContentRef: null,
expandableContentId: '',
labelContainerRef: null,
clearAllFilters: () => {}
});
export const globalBreakpoints = {
md: parseInt(globalBreakpointMd.value) * 16,
lg: parseInt(globalBreakpointLg.value) * 16,
xl: parseInt(globalBreakpointXl.value) * 16,
'2xl': parseInt(globalBreakpoint2xl.value) * 16
};
// Container query breakpoints match CSS container query values
export const containerBreakpoints = {
sm: 286,
md: 478,
lg: 702,
xl: 992, // You may need to verify this value
'2xl': 1200 // You may need to verify this value
};