PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.5.2
LatePoint – Calendar Booking Plugin for Appointments and Events v5.5.2
5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / blocks / src / customer-dashboard / edit.js
latepoint / blocks / src / customer-dashboard Last commit date
block.json 1 year ago edit.js 1 year ago index-min.js 1 year ago index.js 1 year ago save.js 1 year ago
edit.js
158 lines
1 /**
2 * WordPress components that create the necessary UI elements for the block
3 *
4 * @see https://developer.wordpress.org/block-editor/packages/packages-components/
5 */
6 import {TextControl, ToggleControl, Panel, PanelBody, PanelRow} from '@wordpress/components';
7
8
9 /**
10 * React hook that is used to mark the block wrapper element.
11 * It provides all the necessary props like the class name.
12 *
13 * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
14 */
15 import {
16 useBlockProps,
17 InspectorControls,
18 } from '@wordpress/block-editor';
19 import styled from "@emotion/styled";
20
21
22 /**
23 * The edit function describes the structure of your block in the context of the
24 * editor. This represents what the editor will render when the block is used.
25 *
26 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
27 *
28 * @param {Object} props Properties passed to the function.
29 * @param {Object} props.attributes Available block attributes.
30 * @param {Function} props.setAttributes Function that updates individual attributes.
31 *
32 * @return {WPElement} Element to render.
33 */
34 export default function Edit({attributes, setAttributes}) {
35 const blockProps = useBlockProps();
36
37 const LatepointDashboardWrapper = styled.div`
38 box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.1);
39 border-radius: 4px;
40 border: 1px solid #ddd;
41 border-bottom-color: #bbb;
42 background-color: #fff;
43 padding: 20px;
44 `;
45
46 const LatepointDashboardFormCaption = styled.div`
47 font-weight: 500;
48 margin-bottom: 10px;
49 font-size: 12px;
50 text-transform: uppercase;
51 letter-spacing: 1px;
52 `;
53
54 const DItems = styled.div`
55 display: flex;
56 justify-content: space-between;
57 gap: 20px;
58 `;
59
60 const LatepointDashboardItem = styled.div`
61 display: flex;
62 flex-direction: column;
63 padding: 20px;
64 width: 180px;
65 border: 1px solid #ddd;
66 background: #fbfbfb;
67 `;
68
69 const DIName = styled.div`
70 padding: 10px;
71 border-radius: 4px;
72 background-color: #eee;
73 `;
74 const DIBody = styled.div`
75 padding: 10px 0;
76 margin: 10px 0;
77 border-top: 1px solid #ddd;
78 border-bottom: 1px solid #ddd;
79 `;
80
81 const DIFooter = styled.div`
82 `;
83
84 const DIButtonPrev = styled.div`
85 padding: 10px;
86 width: 30px;
87 background-color: #b4c6f5;
88 border-radius: 4px;
89 `;
90
91 const DIDescription = styled.div`
92 padding: 5px;
93 border-radius: 4px;
94 background-color: #f8f8f8;
95 margin-bottom: 5px;
96 `;
97
98
99 return (
100 <div {...blockProps}>
101 <InspectorControls>
102 <Panel>
103 <PanelBody title="Dashboard Settings">
104 <TextControl
105 label="Caption"
106 value={attributes.caption || ''}
107 onChange={(value) => setAttributes({caption: value})}
108 />
109 <ToggleControl
110 label="Hide new appointment button and tab"
111 checked={attributes.hide_new_appointment_ui}
112 onChange={(value) => setAttributes({hide_new_appointment_ui: value})}
113 />
114 </PanelBody>
115 </Panel>
116 </InspectorControls>
117 <LatepointDashboardWrapper>
118 <LatepointDashboardFormCaption>{attributes.caption}</LatepointDashboardFormCaption>
119 <DItems>
120 <LatepointDashboardItem>
121 <DIName></DIName>
122 <DIBody>
123 <DIDescription></DIDescription>
124 <DIDescription></DIDescription>
125 <DIDescription></DIDescription>
126 </DIBody>
127 <DIFooter>
128 <DIButtonPrev></DIButtonPrev>
129 </DIFooter>
130 </LatepointDashboardItem>
131 <LatepointDashboardItem>
132 <DIName></DIName>
133 <DIBody>
134 <DIDescription></DIDescription>
135 <DIDescription></DIDescription>
136 <DIDescription></DIDescription>
137 </DIBody>
138 <DIFooter>
139 <DIButtonPrev></DIButtonPrev>
140 </DIFooter>
141 </LatepointDashboardItem>
142 <LatepointDashboardItem>
143 <DIName></DIName>
144 <DIBody>
145 <DIDescription></DIDescription>
146 <DIDescription></DIDescription>
147 <DIDescription></DIDescription>
148 </DIBody>
149 <DIFooter>
150 <DIButtonPrev></DIButtonPrev>
151 </DIFooter>
152 </LatepointDashboardItem>
153 </DItems>
154 </LatepointDashboardWrapper>
155 </div>
156 );
157 }
158