PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.65
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.65
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / scripts / gutenberg / UIComponents / UISidebarSelectControl.tsx

UISidebarSelectControl.tsx in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.3.65, at scripts/gutenberg/UIComponents/UISidebarSelectControl.tsx

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react';
2
3 import { SelectControl } from '@wordpress/components';
4 import withMetaData from '../../utils/withMetaData';
5 import {
6 useBackgroundAppContext,
7 usePostBackgroundMessage,
8 } from '../../iframe/useBackgroundApp';
9 import { ProxyMessages } from '../../iframe/integratedMessages';
10
11 interface IOption {
12 label: string;
13 value: string;
14 disabled?: boolean;
15 }
16
17 interface IUISidebarSelectControlProps {
18 metaValue?: string;
19 metaKey: string;
20 setMetaValue?: Function;
21 options: IOption[];
22 className: string;
23 label: JSX.Element;
24 }
25
26 const UISidebarSelectControl = (props: IUISidebarSelectControlProps) => {
27 const isBackgroundAppReady = useBackgroundAppContext();
28
29 const monitorSidebarMetaChange = usePostBackgroundMessage();
30
31 return (
32 <SelectControl
33 value={props.metaValue}
34 onChange={content => {
35 if (props.setMetaValue) {
36 props.setMetaValue(content);
37 }
38 isBackgroundAppReady &&
39 monitorSidebarMetaChange({
40 key: ProxyMessages.TrackSidebarMetaChange,
41 payload: {
42 metaKey: props.metaKey,
43 },
44 });
45 }}
46 {...props}
47 />
48 );
49 };
50
51 export default withMetaData(UISidebarSelectControl);
52