PluginProbe
Packeta / 2.3.2
Packeta v2.3.2
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.3.2, at src/PacketaWidget/View.jsx

53 lines 1.0 KB
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 buttonPlace,
16 buttonInfo,
17 inputValue,
18 inputRequired,
19 errorMessage,
20 showLogo,
21 logo,
22 translations,
23 loading,
24 } = view;
25
26 // translations are sometimes unexpectedly undefined
27 if ( ! translations ) {
28 return null;
29 }
30
31 return (
32 <PacketaWidget
33 onClick={ buttonCallback }
34 buttonLabel={ buttonLabel }
35 showLogo={ showLogo }
36 logoSrc={ logo }
37 logoAlt={ translations.packeta }
38 place={ buttonPlace }
39 info={ buttonInfo }
40 loading={ loading }
41 placeholderText={ translations.placeholderText }
42 >
43 <ValidatedTextInput
44 key={ inputRequired ? 'required' : 'optional' }
45 value={ inputValue }
46 required={ inputRequired }
47 errorMessage={ errorMessage }
48 />
49 </PacketaWidget>
50 );
51
52 };
53