PluginProbe
Uji Countdown / trunk
Uji Countdown vtrunk
3.0 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 36 releases
uji-countdown / src / block / edit.js

edit.js in Uji Countdown trunk, at src/block/edit.js

109 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4
5 import icons from './icons';
6 import InspectorControls from './inspector';
7
8 import { __ } from '@wordpress/i18n';
9
10 // import { DateTimePicker } from '@wordpress/components';
11 // import { __experimentalGetSettings } from '@wordpress/date';
12 // import { withState } from '@wordpress/compose';
13
14 import { Component, Fragment } from '@wordpress/element';
15
16 class UjiCountEdit extends Component {
17 render() {
18 const { attributes } = this.props;
19
20 const { countStyles, datetime, timerType, thour, tmin, tsec, url, hide, blank } =
21 attributes;
22
23 const isStyles = typeof ujic_short_vars !== 'undefined' ? true : null;
24
25 const convertDigit = (num) => {
26 return num.length == 1 ? '0' + num : num;
27 };
28
29 if (isStyles) {
30 return (
31 <Fragment>
32 <InspectorControls {...this.props} />
33 {timerType === 'onetime' && (
34 <div className="wp-block-urc-block">
35 <span class="dashicon dashicons dashicons-clock"></span>
36 {__('Expire on:', 'ujicountdown')}{' '}
37 <strong>
38 {' '}
39 <time>{datetime}</time>{' '}
40 </strong>
41 { countStyles && (
42 <div className="wp-ujiblock-ml wp-block-span">
43 {__('Style:', 'ujicountdown')}{' '}
44 <strong> {countStyles} </strong>
45 </div>
46 )}
47 { !countStyles && (
48 <div className="wp-ujiblock-ml wp-block-span">
49 <span class="wp-ujiblock-red"> Please select a style for your timer </span>
50 </div>
51 )}
52 {!hide && (
53 <div className="wp-ujiblock-ml wp-block-span">
54 {__('Redirect to:', 'ujicountdown')}{' '}
55 <strong> {url} </strong>
56 </div>
57 )}
58 </div>
59 )}
60 {timerType === 'repeat' && (
61 <div className="wp-block-urc-block">
62 <span class="dashicon dashicons dashicons-clock"></span>
63 {__('Countdown time:', 'ujicountdown')}{' '}
64 <strong>
65 {' '}
66 <time>
67 {convertDigit(thour)} : {convertDigit(tmin)}{' '}
68 : {convertDigit(tsec)}{' '}
69 </time>{' '}
70 </strong>
71 { countStyles && (
72 <div className="wp-ujiblock-ml wp-block-span">
73 {__('Style:', 'ujicountdown')}{' '}
74 <strong> {countStyles} </strong>
75 </div>
76 )}
77 { !countStyles && (
78 <div className="wp-ujiblock-ml wp-block-span">
79 <span class="wp-ujiblock-red"> Please select a style for your timer </span>
80 </div>
81 )}
82 {!hide && (
83 <div className="wp-ujiblock-ml wp-block-span">
84 {__('Redirect to:', 'ujicountdown')}{' '}
85 <strong> {url} </strong>
86 </div>
87 )}
88 </div>
89 )}
90 </Fragment>
91 );
92 }
93 return (
94 <Fragment>
95 <InspectorControls {...this.props} />
96 <div className="wp-block-urc-block">
97 <h5 style={{ color: 'red', textAlign: 'center' }}>
98 {__(
99 'Please create a countdown style first.',
100 'ujicountdown'
101 )}
102 </h5>
103 </div>
104 </Fragment>
105 );
106 }
107 }
108
109 export default UjiCountEdit;