PluginProbe
WP Ultimate Post Grid / 4.0.1
WP Ultimate Post Grid v4.0.1
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / assets / js / admin-template / menu / index.js

index.js in WP Ultimate Post Grid 4.0.1, at assets/js/admin-template/menu/index.js

115 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React, { Fragment } from 'react';
2
3 import '../../../css/admin/template/menu.scss';
4
5 import Helpers from '../general/Helpers';
6 import Icon from '../general/Icon';
7 import Loader from 'Shared/Loader';
8 import TemplateProperties from './TemplateProperties';
9
10 const Menu = (props) => {
11 return (
12 <div id="wpupg-template-sidebar">
13 {
14 props.editing
15 &&
16 <div id="wpupg-template-buttons">
17 <p>Editing template: { props.template.name }</p>
18 {
19 props.savingTemplate
20 ?
21 <Loader/>
22 :
23 <Fragment>
24 <button
25 className="button button-primary"
26 disabled={ ! props.changesMade }
27 onClick={() => {
28 if ( confirm( 'Are you sure you want to save your changes?' ) ) {
29 props.onSaveTemplate({
30 ...props.template,
31 });
32 }
33 }}
34 >{ props.savingTemplate ? '...' : 'Save Changes' }</button>
35 <button
36 className="button"
37 onClick={() => {
38 if ( ! props.changesMade || confirm( 'Are you sure you want to cancel your changes?' ) ) {
39 props.onChangeEditing(false);
40 }
41 }}
42 >{ props.changesMade ? "Cancel Changes" : "Stop Editing" }</button>
43 </Fragment>
44 }
45 </div>
46 }
47 <div id="wpupg-template-menu">
48 {
49 ! props.editing
50 ?
51 <Fragment>
52 <a
53 className={ 'manage' === props.mode ? "wpupg-template-menu-group active" : "wpupg-template-menu-group" }
54 onClick={ (e) => { props.onChangeMode( 'manage' ) } }
55 ><Icon type='manage' /> Manage Templates</a>
56 </Fragment>
57 :
58 <Fragment>
59 <a
60 className={ 'properties' === props.mode ? "wpupg-template-menu-group active" : "wpupg-template-menu-group" }
61 onClick={ (e) => { props.onChangeMode( 'properties' ) } }
62 ><Icon type='properties' /> Template Properties</a>
63 <a
64 className={ 'blocks' === props.mode ? "wpupg-template-menu-group active" : "wpupg-template-menu-group" }
65 onClick={ (e) => { props.onChangeMode( 'blocks' ) } }
66 ><Icon type='blocks' /> Edit Blocks</a>
67 <a
68 className={ 'add' === props.mode ? "wpupg-template-menu-group active" : "wpupg-template-menu-group" }
69 onClick={ (e) => { props.onChangeMode( 'add' ) } }
70 ><Icon type='add' /> Add Blocks</a>
71 <a
72 className={ 'remove' === props.mode ? "wpupg-template-menu-group active" : "wpupg-template-menu-group" }
73 onClick={ (e) => { props.onChangeMode( 'remove' ) } }
74 ><Icon type='remove' /> Remove Blocks</a>
75 <a
76 className={ 'html' === props.mode ? "wpupg-template-menu-group active" : "wpupg-template-menu-group" }
77 onClick={ (e) => { props.onChangeMode( 'html' ) } }
78 ><Icon type='html' /> Edit HTML</a>
79 <a
80 className={ 'css' === props.mode ? "wpupg-template-menu-group active" : "wpupg-template-menu-group" }
81 onClick={ (e) => { props.onChangeMode( 'css' ) } }
82 ><Icon type='css' /> Edit CSS</a>
83 </Fragment>
84 }
85 </div>
86 {
87 'properties' === props.mode && props.template
88 ?
89 <TemplateProperties
90 template={props.template}
91 onChangeTemplateProperty={props.onChangeTemplateProperty}
92 />
93 :
94 null
95 }
96 <div
97 id="wpupg-add-blocks"
98 style={{ display: 'add' !== props.mode ? 'none' : 'block' }}
99 className="wpupg-template-properties"
100 ></div>
101 <div
102 id="wpupg-remove-blocks"
103 style={{ display: 'remove' !== props.mode ? 'none' : 'block' }}
104 className="wpupg-template-properties"
105 ></div>
106 <div
107 id="wpupg-block-properties"
108 style={{ display: 'blocks' !== props.mode ? 'none' : 'block' }}
109 className="wpupg-template-properties"
110 ></div>
111 </div>
112 );
113 }
114
115 export default Menu;