-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathindex.tsx
More file actions
37 lines (35 loc) · 1.6 KB
/
Copy pathindex.tsx
File metadata and controls
37 lines (35 loc) · 1.6 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
import React from 'react';
import WidgetDrawer from 'components/engagement/form/EngagementWidgets/WidgetDrawer';
import { WidgetDrawerProvider } from 'components/engagement/form/EngagementWidgets/WidgetDrawerContext';
import { WidgetPickerButton } from './WidgetPickerButton';
import { WidgetLocation } from 'models/widget';
/**
* WidgetPicker component allows users to select and manage widgets for a specific location in an engagement.
* It provides a button to open the widget drawer and displays the selected widgets.
* The component is wrapped in a context provider to manage actions and widget state.
* @param {Object} props - The properties for the WidgetPicker component.
* @param {WidgetLocation} props.location - The location where the widget will be placed in the engagement.
* @returns {JSX.Element} A component that displays a button to pick widgets and a drawer for widget management.
* @example
* <WidgetPicker location={WidgetLocation.Header} />
* @see {@link WidgetPickerButton} for the button that opens the widget drawer.
* @see {@link WidgetDrawer} for the drawer that displays available widgets.
* @see {@link WidgetDrawerProvider} for the context provider that manages widget state.
*/
export const WidgetPicker = ({
location,
detailsTabId,
tabIndex,
}: {
location: WidgetLocation;
detailsTabId?: number;
tabIndex?: number;
}) => {
return (
<WidgetDrawerProvider>
<WidgetPickerButton location={location} detailsTabId={detailsTabId} tabIndex={tabIndex} />
<WidgetDrawer />
</WidgetDrawerProvider>
);
};
export default WidgetPicker;