PluginProbe
Packeta / 2.1
Packeta v2.1
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / PacketaWidget / View.jsx

View.jsx in Packeta 2.1, at src/PacketaWidget/View.jsx

51 lines 998 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { ValidatedTextInput } from '@woocommerce/blocks-components';
2 import { PacketaWidget } from './PacketaWidget';
3 import { useView } from "./useView";
4
5 export const View = ( { cart } ) => {
6
7 const view = useView( cart );
8 if ( null === view ) {
9 return null;
10 }
11
12 const {
13 buttonCallback,
14 buttonLabel,
15 buttonInfo,
16 inputValue,
17 inputRequired,
18 errorMessage,
19 showLogo,
20 logo,
21 translations,
22 loading,
23 } = view;
24
25 // translations are sometimes unexpectedly undefined
26 if ( ! translations ) {
27 return null;
28 }
29
30 return (
31 <PacketaWidget
32 onClick={ buttonCallback }
33 buttonLabel={ buttonLabel }
34 showLogo={ showLogo }
35 logoSrc={ logo }
36 logoAlt={ translations.packeta }
37 info={ buttonInfo }
38 loading={ loading }
39 placeholderText={ translations.placeholderText }
40 >
41 <ValidatedTextInput
42 key={ inputRequired ? 'required' : 'optional' }
43 value={ inputValue }
44 required={ inputRequired }
45 errorMessage={ errorMessage }
46 />
47 </PacketaWidget>
48 );
49
50 };
51