forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabsContext.ts
More file actions
34 lines (31 loc) · 978 Bytes
/
TabsContext.ts
File metadata and controls
34 lines (31 loc) · 978 Bytes
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
import { createContext } from 'react';
export interface TabsContextProps {
variant: 'default' | 'secondary';
mountOnEnter: boolean;
unmountOnExit: boolean;
localActiveKey: string | number;
uniqueId: string;
setAccentStyles: (shouldInitializeStyles?: boolean) => void;
handleTabClick: (
event: React.MouseEvent<HTMLElement, MouseEvent>,
eventKey: number | string,
tabContentRef: React.RefObject<any>
) => void;
handleTabClose?: (
event: React.MouseEvent<HTMLElement, MouseEvent>,
eventKey: number | string,
tabContentRef?: React.RefObject<any>
) => void;
}
export const TabsContext = createContext<TabsContextProps>({
variant: 'default',
mountOnEnter: false,
unmountOnExit: false,
localActiveKey: '',
uniqueId: '',
setAccentStyles: () => null,
handleTabClick: () => null,
handleTabClose: undefined
});
export const TabsContextProvider = TabsContext.Provider;
export const TabsContextConsumer = TabsContext.Consumer;