PluginProbe
Uji Countdown / 2.2
Uji Countdown v2.2
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 2.2, at src/block/edit.js

86 lines 2.0 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 { 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 {__('Expire on:', 'ujicountdown')}{' '}
36 <strong>
37 {' '}
38 <time>{datetime}</time>{' '}
39 </strong>
40 {!hide && (
41 <div className="wp-block-span">
42 {__('Redirect to:', 'ujicountdown')}{' '}
43 <strong> {url} </strong>
44 </div>
45 )}
46 </div>
47 )}
48 {timerType === 'repeat' && (
49 <div className="wp-block-urc-block">
50 {__('Countdown time:', 'ujicountdown')}{' '}
51 <strong>
52 {' '}
53 <time>
54 {convertDigit(thour)} : {convertDigit(tmin)}{' '}
55 : {convertDigit(tsec)}{' '}
56 </time>{' '}
57 </strong>
58 {!hide && (
59 <div className="wp-block-span">
60 {__('Redirect to:', 'ujicountdown')}{' '}
61 <strong> {url} </strong>
62 </div>
63 )}
64 </div>
65 )}
66 </Fragment>
67 );
68 }
69 return (
70 <Fragment>
71 <InspectorControls {...this.props} />
72 <div className="wp-block-urc-block">
73 <h5 style={{ color: 'red', textAlign: 'center' }}>
74 {__(
75 'Plese create a countdown style first.',
76 'ujicountdown'
77 )}
78 </h5>
79 </div>
80 </Fragment>
81 );
82 }
83 }
84
85 export default UjiCountEdit;
86